Re: Password for certificate



Do you have a p12 or pfx file that contains the certificate and private key instead?

What I'm guessing is happening is that you supply the .cer file and .NET uses that to locate the matching certificate installed in the local store and then tries to access the private key in the local store to do the client auth but it does not use the password you supplied to access the key because that particular constructor is designed to use a stand alone p12 file and use the password to open it.

Just a guess...

--
Joe Kaplan-MS MVP Directory Services Programming
Co-author of "The .NET Developer's Guide to Directory Services Programming"
http://www.directoryprogramming.net
"kejster" <kejster@xxxxxxxxxxxxxxxxxxxxxxxxx> wrote in message news:329232C8-3E99-4FF7-B607-A5E9B9536118@xxxxxxxxxxxxxxxx
I'm trying to talk to a webservice that requires a certificate. I have
generated a .CER file using certmgr.
My code looks like this:

ServicePointManager.ServerCertificateValidationCallback = New
RemoteCertificateValidationCallback(AddressOf ValidateServerCertificate)

certFile = ConfigurationManager.AppSettings.Get("CertificateFile")

password = ConfigurationManager.AppSettings.Get("CertPassword")

certificate = New X509Certificate2(certFile, password)

service.ClientCertificates.Add(certificate)

resultString = service.DoSomething()

However, when my code reaches the line where I actually call the webservice,
I am prompted with a dialog that asks me to enter my password (same as if I'd
used the certificate to log into homebanking etc.).

I would like my application to run in the background, without requiring the
user to enter the password every time the webservice is called.

Any suggestions?

.



Relevant Pages

  • Re: Does deleting a certificate cause private key deletion?
    ... > If I have a certificate installed on a system ... > private key also get deleted from the machine? ... > Certificate wizard to install the certificate from the .CER file. ... > 4) Using MMC Certificates snap-in, ...
    (microsoft.public.platformsdk.security)
  • Re: Does deleting a certificate cause private key deletion?
    ... > If I have a certificate installed on a system ... > private key also get deleted from the machine? ... > Certificate wizard to install the certificate from the .CER file. ... > 4) Using MMC Certificates snap-in, ...
    (microsoft.public.win2000.security)
  • RE: DRA cannont open EFS files
    ... The .CER file is just the certificate. ... You need the .PFX file which is the certificate and the private key. ... > I login as admin, create the .CER file and use MMC to set the admin as the ...
    (microsoft.public.windowsxp.security_admin)
  • Re: Public keys encryption [ urgent ]
    ... > are not in a domain, then you also need to import the Certificate Authority ... A .cer file does not include the private key, ... if install the certificate on each side that is win 2k server and win 2k ...
    (microsoft.public.win2000.security)
  • Re: Unable to use third-party cert after Exch Sp2 update on SBS200
    ... Every *server* certificate in IIS has to ... The public key is sent when a request from a browser ... The public key is used to *decrypt* data. ... The private key is used ...
    (microsoft.public.windows.server.sbs)