If they are lucky to have licenses to use a template from v3 Windows Vista or higher, and the same were issued by a Windows Server 2008 R2 is find a happy exception ( Invalid provider type specified. ) trying to get PrivateKey property of an instance of X509Certificate.
This occurs, as well explained in this post due to how Windows Vista and Seven store this type of certificate - using Microsoft Software Key Storage Provider - is only supported by CryptoAPI , but not for the libraries provided by . NET Framework 4.0 or earlier.
The way around this is using the libraries provided by the friends of the CLR Security Team :
- Include " using Security.Cryptography.X509Certificates; "in the file that used to bring certificates to the class extension Methods X509Certificate2
- Ask for HasCngKey () in X509Certificate2 instance to see if the key is stored in this way. If so, create a new instance of RSACng using the method GetCngPrivateKey () as a parameter.
Zaiden
0 comments:
Post a Comment