DSACryptoServiceProvider constructor throws CryptographicException

Posted by Rick on Stack Overflow See other posts from Stack Overflow or by Rick
Published on 2010-06-16T21:54:36Z Indexed on 2010/06/16 22:02 UTC
Read the original article Hit count: 302

Filed under:
|

This code below thows the following error: System.Security.Cryptography.CryptographicException "The handle is invalid"

CspParameters CSPParam = new System.Security.Cryptography.CspParameters(13, null, null);
CSPParam.Flags = CspProviderFlags.UseMachineKeyStore;
CSPParam.KeyContainerName = "MyKeys";

System.Security.Cryptography.DSACryptoServiceProvider r = new System.Security.Cryptography.DSACryptoServiceProvider(CSPParam);  //Error occurs here

This code had been working with no issues then it started throwing this error. I can't think of anything that I have changed that relates to this. Has nayone seen this error? Any ideas of what to try?

© Stack Overflow or respective owner

Related posts about c#

Related posts about cryptography