Re: Cannot find the certificate and private key for decryption at Microsoft.Web.Services.Security.X509.X509Certificate.get_Key()



yes i did export the private key, i have opened the Certificate and saw it
also show that it has the private key.
it works fine on Application not on Web Site Same machine.
thank you
bhu

"Pablo Cibraro [MVP]" <pcibraro@xxxxxxxxxxx> wrote in message
news:esljDv6vGHA.4140@xxxxxxxxxxxxxxxxxxxxxxx
Hi,

Did you also export the private key ? (Some certificates are installed
without the "private key - export" support, so there is no way to move
them between different machines if you do not have the original pfx file).

Regards,
Pablo Cibraro.

"bhu" <bhuvaneshwar@xxxxxxxxxxx> wrote in message
news:eEnHDlwvGHA.1372@xxxxxxxxxxxxxxxxxxxxxxx
I am getting this Error, we have a application which is there in the
Server with Certificates,
and it is working fine done by some one else.
I am taking care of that app now, and i don;t have any info on how they
installed etc.
i am trying to put it in my machine for support etc, but cannot make it
to work.
So i have created a sample web app with the same code, but i get this
error,
System.ComponentModel.Win32Exception: Cannot find the certificate and
private key for decryption at
Microsoft.Web.Services.Security.X509.X509Certificate.get_Key()

The same code created on winform and it works fine.
i have done all these : permmision given to ASPNet, NetworkServices to
this dir C:\Documents and Settings\All Users\Application
Data\Microsoft\Crypto\RSA\MachineKeys.
To install the Certificates i used mmc Certificates and import the .pfx
file,
Here is the snippet of the code.
X509CertificateStore certStore
=X509CertificateStore.LocalMachineStore(X509CertificateStore.RootStore);


certStore.OpenRead();

X509CertificateCollection certs
=certStore.FindCertificateBySubjectString("NSet.net");




X509Certificate oCert =((X509Certificate) certs[0]);

try

{if (!oCert.SupportsDigitalSignature || (oCert.Key == null))

{Response.Write(" fail");}

else

{Response.Write(oCert.Key.ToString());

Response.Write(oCert.ToString());}}

catch(Exception ee)

any ideas please post it.
thanks
bhu






.



Relevant Pages