Hi Dr. Henson / list,

This is the code that I was using to convert my blob to an OpenSSL certificate (the 
problem I have
with this working code is that CryptBinaryToString is only available on XP):

---------------------------------------------------------------------------------
CryptGetUserKey(hRainbow, AT_KEYEXCHANGE, &hUserKey);

 DWORD dwCertLength = 0;
CryptGetKeyParam(hUserKey,KP_CERTIFICATE,NULL, &dwCertLength, 0);

 BYTE *pCert = new BYTE[dwCertLength];
CryptGetKeyParam(hUserKey,KP_CERTIFICATE, pCert, &dwCertLength, 0);

 DWORD dwLengthBase64;
CryptBinaryToString(pCert, dwCertLength, CRYPT_STRING_BASE64HEADER, NULL, 
&dwLengthBase64);

 LPSTR szBase64 = new char[dwLengthBase64];
CryptBinaryToString(pCert, dwCertLength, CRYPT_STRING_BASE64HEADER, szBase64, 
&dwLengthBase64);
-----------------------------------------------------------------------------------

Thanks!
Mike Gagnon


> On Mon, Dec 01, 2003, Mike Gagnon wrote:
>
> > Hi list,
> >
> > Would anyone know how to convert a CAPI certificate blob to an OpenSSL X509 
> > certificate?
> >
> > Thanks very much!
> > Mike Gagnon
> >
> >
>
> Depends on what you mean by a "CAPI certificate blob". It might already by a
> DER format certificate or could be several certificates packaged as PKCS#7 or
> PKCS#12: it depends on the CryptoAPI commands of functions used to create it.
>
> Steve.
> --
> Dr Stephen N. Henson. Email, S/MIME and PGP keys: see homepage
> OpenSSL project core developer and freelance consultant.
> Funding needed! Details on homepage.
> Homepage: http://www.drh-consultancy.demon.co.uk
> ______________________________________________________________________
> OpenSSL Project                                 http://www.openssl.org
> User Support Mailing List                    [EMAIL PROTECTED]
> Automated List Manager                           [EMAIL PROTECTED]

______________________________________________________________________
OpenSSL Project                                 http://www.openssl.org
User Support Mailing List                    [EMAIL PROTECTED]
Automated List Manager                           [EMAIL PROTECTED]

Reply via email to