On Mon, Dec 01, 2003, Mike Gagnon wrote:

> 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);
> -----------------------------------------------------------------------------------
> 

Well from the description on MS site its probably PEM format already. You can
test that with:

openssl x509 -in cert.pem -text 

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]

Reply via email to