Hello, You can do something like the following. First make a type corresponding to a stack of x509 attributes: typedef STACK_OF(X509_ATTRIBUTE) SEQ_X509_ATTRIBUTE; DECLARE_ASN1_FUNCTIONS(SEQ_X509_ATTRIBUTE); Then make an asn1 template that specifies how the stack should be encoded. (You can use ASN1_TFLG_SET_OF instead of ..SEQUENCE_OF here, depending on the DER you're trying to interpret, I don't know.) ASN1_ITEM_TEMPLATE(SEQ_X509_ATTRIBUTE) = ASN1_EX_TEMPLATE_TYPE(ASN1_TFLG_SEQUENCE_OF, 0, x509attribute, X509_ATTRIBUTE) ASN1_ITEM_TEMPLATE_END(SEQ_X509_ATTRIBUTE) IMPLEMENT_ASN1_FUNCTIONS(SEQ_X509_ATTRIBUTE) Now your type has its own d2i and i2d functions, and you can use them: STACK_OF(X509_ATTRIBUTE) *attrs = d2i_SEQ_X509_ATTRIBUTE(NULL, &data, length); Cheers, -Dave
|
-- openssl-users mailing list To unsubscribe: https://mta.openssl.org/mailman/listinfo/openssl-users