By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
440,161 Members | 2,002 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 440,161 IT Pros & Developers. It's quick & easy.

X509Certificate2.HasPrivateKey = true, but no PrivateKey?

P: n/a
Hi,

I have a X509 certifikate, with public- and privatekey.
For test reasons, I programed a small Consoleapplication, which executes
with my user rights (Administrator).

When I am reading an X509Certificate, the property HasPrivateKey of the
X509Certificate2 is set to "true". I can also check the publickey

But if I want to use the PrivateKey Property, after a while i get the error
message "Keyset does not exist",

That's the stacktrace for it:
bei System.Security.Cryptography.Utils.CreateProvHandl e(CspParameters
parameters, Boolean randomKeyContainer)\r\n bei
System.Security.Cryptography.Utils.GetKeyPairHelpe r(CspAlgorithmType
keyType, CspParameters parameters, Boolean randomKeyContainer, Int32
dwKeySize, SafeProvHandle& safeProvHandle, SafeKeyHandle& safeKeyHandle)\r\n
bei System.Security.Cryptography.RSACryptoServiceProvi der.GetKeyPair()\r\n
bei System.Security.Cryptography.RSACryptoServiceProvi der..ctor(Int32
dwKeySize, CspParameters parameters, Boolean useDefaultKeySize)\r\n bei
System.Security.Cryptography.RSACryptoServiceProvi der..ctor(CspParameters
parameters)\r\n bei
System.Security.Cryptography.X509Certificates.X509 Certificate2.get_PrivateKey()\r\n
bei SecurityHelper.SignatureHelper.FindCertificate(Cer tificateIdentification
certIdentification, String certAttributeData) in D:\\DATEN\\AmonD\\Visual
Studio
2005\\Projects\\ConsoleApplication1\\ConsoleApplic ation1\\SignatureHelper.cs:Zeile
120.

I don't have a plan, what's the reason? :-(

Thanks,
Dominik


Nov 12 '08 #1
Share this question for a faster answer!
Share on Google+

This discussion thread is closed

Replies have been disabled for this discussion.