On Mon, Feb 12, 2007, Michael Leuchtner wrote:

> Seems I do something wrong when I create/ convert my BMPSTRING. When I create 
> my certificate reqeust I always get an octet string value (FD FD FD FD AB AB 
> AB AB AB AB AB AB ) but no embedded bmpstring. Strange thing is, when I 
> alternate the string ("myTemplate") to an other string (of the same length) 
> the octet value (FD FD ...) don't change.
> What's wrong?
> 
> Here's my code:
> 
> ...
> char* t = "myTemplate";
> nid = OBJ_create("1.3.6.1.4.1.311.20.2", "szOID_ENROLL_CERTTYPE_EXTENSION", 
> "szOID_ENROLL_CERTTYPE_EXTENSION");
> 
> ASN1_BMPSTRING* str = ASN1_BMPSTRING_new();
> ASN1_STRING_set(str, (unsigned char*)t, strlen(t));
> int size = i2d_ASN1_BMPSTRING(str, NULL);
> unsigned char *oStr = (unsigned char*)malloc(size);
> 
> i2d_ASN1_BMPSTRING(str, &oStr);

The above call is wrong: read the FAQ.

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                    openssl-users@openssl.org
Automated List Manager                           [EMAIL PROTECTED]

Reply via email to