J
jwei
i tried to add a root certificate via code :
....//read cert file into buffer
X509Certificate cert = new X509Certificate(buffer); //cert is ok
X509Store store = new X509Store(StoreName.Root, StoreLocation.LocalMachine);
store.Open(OpenFlags.ReadWrite);
store.Certificates.Add(cert);
store.Close();
but the certificate doesnt get added
so i tried it with native function :
CertOpenStore/CertAddEncodedCertificateToStore
with this functions i can add the certifiacte to HKCU -> Ca or trust without
prompt (i cannot add to Root, since i dont have a display)
but if a do a WebRequest to a ssl url, it doesnt work (cannot establish a
trust connection ...)
if a add my certificate during os desing phase to the sysroots.p7b the
request works fine - but i want to add the certificate during runtime ...
....//read cert file into buffer
X509Certificate cert = new X509Certificate(buffer); //cert is ok
X509Store store = new X509Store(StoreName.Root, StoreLocation.LocalMachine);
store.Open(OpenFlags.ReadWrite);
store.Certificates.Add(cert);
store.Close();
but the certificate doesnt get added
so i tried it with native function :
CertOpenStore/CertAddEncodedCertificateToStore
with this functions i can add the certifiacte to HKCU -> Ca or trust without
prompt (i cannot add to Root, since i dont have a display)
but if a do a WebRequest to a ssl url, it doesnt work (cannot establish a
trust connection ...)
if a add my certificate during os desing phase to the sysroots.p7b the
request works fine - but i want to add the certificate during runtime ...