Cannot get the private key from my Cert

I tried using the code in this article here:http://www.eggheadcafe.com/articles/20030326.asp

I had to modify it obviously but I am having trouble getting the private key (cert.Key) from the certification I created and installed.

makecert -sk PAB -n "CN=Dave" -ss root -sr localmachine MyCertTwo.cer

I successfully get the Cert from my cert store and its the right one. But in the watch window for the Key value I get this

<error: an exception of type: {System.ComponentModel.Win32Exception} occurred> System.Security.Cryptography.RSA

I later try to use the cert to sign my XML with this
Dim key As RSA = cert.Key
signer.SigningKey = key


Then when I try to access the cert I get the followingThen when I try to access the cert I get the following:

System.ComponentModel.Win32Exception: Cannot find the certificate and private key for decryption




Answer this question

Cannot get the private key from my Cert

  • Cannot get the private key from my Cert