RE: Installing X509Certificate to the cert store programatically



Hi,

I have in stalled x509Certificate manually using mmc....that works

Swagata

"JohnnySparkles" wrote:

> Hi Everyone,
>
> I'm having a bit of difficulty installing an X509Certificate which I have
> created from the Active Directory "userCertificate" property of a user in my
> Active Directory.
>
> Here's what I'm trying to do, assume the X509Certificate was created from
> the byte[] retrieved from the Active Directory.
>
> X509Certificate* xADCert = new X509Certificate(byte[]);
>
> X509CertificateStore* xStore =
> X509CertificateStore::CurrentUserStore(X509CertificateStore::MyStore);
>
> if(!xStore->Open())
> {
> //Exit
> return ;
> }
>
> xStore->Certificates->Add(xADCert);
>
> xStore->Close();
> //End
>
> Now once this has finished I go and check the certificate store and I can't
> see my certificate added anywhere. I figured there might be some permissions
> problems with the certificate store I was trying to write to and have tried a
> few different stores with no luck.
>
> I've also tried installing other certificates which I know are valid as
> well as dumping the byte[] returned from AD into a file on the local disk and
> then installing it manually into the certificate store....I also tried
> ->Insert() instead of ->Add()
>
> I'm starting to wonder if this is really possible at all? Has anyone managed
> to do this?
>
> Thanks for your help
> Johnny
.



Relevant Pages