Re: CertAddEncodedCertificateToStore



"Will" <auktion@xxxxxxxxxxxxxx> wrote in message
news:ez07pD40HHA.1164@xxxxxxxxxxxxxxxxxxxxxxx
I want to add a certificate to the certificate store. The function
CertAddEcode.. fails with CRYPT_E_NOT_FOUND; I think it doesn't find the
private key. What must i call that the certimport works correct ?

if opended the store with hstore2 = CertOpenSystemStore(
hCryptProv, "MY" ); where hCryptProv is a valid handle to the
CSP-Provider.
CertAddEncodedCertificateToStore( hstore2, MY_ENCODING_TYPE,
cert->pbCertEncoded, cert->cbCertEncoded, CERT_STORE_ADD_ALWAYS, NULL );

Has anyone a idea whats wrong ? Do i have to set anything before calling
the funcion ? What ?

Could it be because "MY_ENCODING_TYPE" is not a supported encoding type?

You should be using "X509_ASN_ENCODING | PKCS_7_ASN_ENCODING" for that
value. That means, very specifically, an X.509 format certificate that has
been encoded in the PKCS #7 format. Is your certificate encoded in that
fashion?

Alun.
~~~~


.