"Almost. If the actual value is not OCTET STRING, change the type created
in the first two (or whatever) lines, and i2d'ed in the fourth line.
And OPENSSL_free the pointer allocated here (d) after you're
done with that memory. "
I need to add an INTEGER extensions and PRINTABLESTRING extension.
I tried folowing your instructions, and used an exmple from this forum, but
still get rubbish
//1) create the integer and populate it:
nid = OBJ_create(" 1.3.6.1.4.1.12345", "EndEntityType",
"EndEntityType");
ASN1_OBJECT* obj = OBJ_nid2obj(nid);
ASN1_INTEGER * int1 = ASN1_INTEGER_new();
ASN1_INTEGER_set(int1, 1);
//2) figure out the length it would take when converted from
internal into der/asn1 wire encoding:
int n = i2d_ASN1_INTEGER(int1,NULL);
//3) Ensure we have the needed space for that:
ASN1_OCTET_STRING data1;
data1.data = malloc(n);
data1.length = n;
//4) Fill out the ASN1 string by translating it again - this time
into the buffer.
unsigned char * p =M_ASN1_STRING_data(&data1);
i2d_ASN1_INTEGER(int1,&p);
//5) add to the extension stack.
sk_X509_EXTENSION_push(st_exts, X509_EXTENSION_create_by_OBJ(NULL,
obj, 0, &data1));
what is wrong with this?
--
View this message in context:
http://openssl.6102.n7.nabble.com/Adding-a-custom-extension-to-a-CSR-tp47446p47537.html
Sent from the OpenSSL - User mailing list archive at Nabble.com.
______________________________________________________________________
OpenSSL Project http://www.openssl.org
User Support Mailing List [email protected]
Automated List Manager [email protected]