Adding certificate using X509Store
- From: "Phil Lee" <phil.lee@xxxxxxxxxxxxxxxxx>
- Date: Mon, 3 Sep 2007 15:51:19 +0100
Hi,
I'm having an odd problem using X509Store.
This code is called from a test winForms app.
public static void Install()
{
X509Certificate2 certificate = new X509Certificate(Resources.certificate, "password");
X509Store store = new X509Store(StoreName.My, StoreLocation.LocalMachine);
store.Open(OpenFlags.ReadWrite);
try
{
store.Add(certificate);
}
finally
{
store.Close();
}
}
Resource.certificate is a byte[] containing the public/private certificate.
When I press the corresponding "Install" button in my app I see the private key created in "C:\ProgramData\Microsoft\Crypto\RSA\MachineKeys".
However as soon as I close the test app the private key is deleted - what is going on?
This behaviour occurs on Vista64 + Win2k3_SP2.
Note that if I install using the mmc in Vista or winhttpcertcfg on Win2k3 the private key is installed and stays installed.
Re
.
- Follow-Ups:
- RE: Adding certificate using X509Store
- From: Steven Cheng[MSFT]
- RE: Adding certificate using X509Store
- Prev by Date: RE: WSE 3.0 SOAP Router for load balancing
- Next by Date: RE: Adding certificate using X509Store
- Previous by thread: RE: WSE 3.0 SOAP Router for load balancing
- Next by thread: RE: Adding certificate using X509Store
- Index(es):
Loading