Am 21.09.2011 23:27, schrieb Chang Lee: > Does anyone know of a way to take an ASN1_OCTET_STRING that contains a > DER encoded Sequence and extract the contents of the Sequence as an > ASN1_STRING. Essentially, I want to construct an ASN1 object of the > Sequence. I guess I could manually parse the Sequence (and deal with > the different types of length encoding) but I figure there must be an > easier way.
You can use the macros in asn1t.h for parsing DER encoded data. Have a look at the comment starting at line 132 (I'm using OpenSSL 1.0.0e) of this header file. It explains how to declare an ASN1 SEQUENCE. You can find plenty of examples using these macros within the OpenSSL source (for example crypto/pkcs7/p7_asn1.c). However, I'm not exactly sure whether or not the ASN1 subsystem is meant to be used outside of OpenSSL. I couldn't find a lot of documentation about it and learned how to use it by reading the source. Maybe one of the OpenSSL developers could comment on this. Best regards, Dominik ______________________________________________________________________ OpenSSL Project http://www.openssl.org User Support Mailing List openssl-users@openssl.org Automated List Manager majord...@openssl.org