[openssl-users] SKM_ASN1_SET_OF_i2d

Thomas Francis, Jr. thomas.francis.jr at pobox.com
Tue Sep 13 19:30:48 UTC 2016

What’s the replacement for code that used SKM_ASN1_SET_OF_i2d in OpenSSL 1.1?  The code I’ve got that calls this function is getting the DER encoding of a STACK_OF() as a sorted SET.  This STACK_OF() is of a custom ASN1 type; and is a member of another structure that is also a custom ASN1 structure.

The call looks like this:

int len = SKM_ASN1_SET_OF_i2d(structureName, containingStructure->member, NULL, i2d_structureName, V_ASN1_SET, V_ASN1_UNIVERSAL, IS_SET);*

“structureName” is the typedef’d name of the C struct, which was also passed to the DEFINE_STACK_OF() and DECLARE_ASN1_FUNCTIONS() macros (in OpenSSL < 1.1, it’s DECLARE_STACK_OF(), not DEFINE_STACK_OF() ).

“containingStructure” is a pointer to a C struct, and its member, “member” is of the type, STACK_OF(structureName).



* And later it’s called again with a valid pointer of size len instead of NULL for the third parameter, to actually obtain the DER encoding.

More information about the openssl-users mailing list