On Thu September 22 2011, Chang Lee wrote: > Thanks Dominik for the tip. Actually, I have been poring over the OpenSSL > code, though we're using the 0.9.8 branch, hoping to find a built-in > primitive SEQUENCE to use but to no avail. As you say, there are templates > for primitives and I looked at how the PKCS7 was composed from those > primitives but there are so many levels of indirection that it's time > consuming to follow. >
Let the compiler help you, try the: "-E" option switch. Mike > I guess using C to implement features that object > oriented languages such as C++ expose declaratively makes things more > complex. I'll keep looking... > > -CLee > > > On Thu, Sep 22, 2011 at 2:41 AM, Dominik Oepen < > oe...@informatik.hu-berlin.de> wrote: > > > 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 > > > ______________________________________________________________________ OpenSSL Project http://www.openssl.org User Support Mailing List openssl-users@openssl.org Automated List Manager majord...@openssl.org