by anita de jong posted on 2004/10/08 |
|
When I import a certificate of us manually in IE, I can see
1 CA Root certificate
1 CA certificate
1 user certificate
-> 3 certificates
I've read in the help-file security library help that adding a certificate from a pfx-File is not that simple:
<code>
Certificate pfxCert;
pfxCert = Certificate.CreateFromPfxFile(filename, password, false);
</code>
you have to get all certificates out of the CertificateChain... (correct?)
but there seems only one certificate to be in it: CA Root
<code>
CertificateChain chain = pfxCert.GetCertificateChain();
certs = chain.GetCertificates();
System.Console.WriteLine("number of certs: " + certs.Length);
</code>
number of certs: 1
I don't receive any error-Message, but in IE, I can't find the certificate...
how can I get the other certificates into the store?
Thank you in advance
Anita
----------------------
<code>
storeLocation = StoreLocation.CurrentUser;
storeLocation = StoreLocation.LocalMachine;
store = new CertificateStore(storeLocation, CertificateStore.RootStore);
store.AddCertificate(pfxCert);
store = new CertificateStore(storeLocation, CertificateStore.CAStore);
store.AddCertificate(pfxCert);
store = new CertificateStore(storeLocation, CertificateStore.MyStore);
store.AddCertificate(pfxCert);
</code>
|