1. m_safeCertContext is an invalid handle
I got this issue when try to assign a X509SigningCredentials to the custom STSConfiguration.
this.SigningCredentials = new X509SigningCredentials(cert);
Make sure don’t call cert.Reset() before passing the cert to X509SigningCredentials constructor
2. Keyset does not exist
3. A potentially dangerous Request.Form value was detected from the client (wresult=”<trust:RequestSecuri…”).
Make sure you have this setting in your web.config (under system.web)