> From: owner-openssl-users On Behalf Of Danyk
> Sent: Wednesday, December 04, 2013 12:26

>       I used this , and it seems to work great (parsed it with ASN1):
> 
>          st_exts    = sk_X509_EXTENSION_new_null();
>          X509_REQ *x;
> 
>         /*add INTEGER EXT*/
>         int1 = ASN1_INTEGER_new();
>         ASN1_INTEGER_set(int1, 1);
> 
>       os1 = M_ASN1_OCTET_STRING_new();
>         os1->data = NULL;
> 
>       n =  i2d_ASN1_INTEGER(int1,&os1->data);
>         os1->length = n;
> 
That's clever. That uses the pointer and length in the OCTET_STRING 
object directly, instead of separate variables as I did. But it produces 
the same result, which is what matters.

>         sk_X509_EXTENSION_push(st_exts,
>           X509_EXTENSION_create_by_OBJ(NULL, obj1, 0,os1));
> 
<snip rest>
> I freed all the ASN1 structs at the end...
> Did I add the extension the way you meant? Do I need to free anything
else?
> 
Close enough. Assuming you freed with the ASN1_xxx_free routines 
(not direct OPENSSL_free) I think that should get everything, although 
personally I would run through a malloc debugger like valgrind and 
let it check. Computers are better at that than humans.


______________________________________________________________________
OpenSSL Project                                 http://www.openssl.org
User Support Mailing List                    openssl-users@openssl.org
Automated List Manager                           majord...@openssl.org

Reply via email to