On Tue, Apr 03, 2012, Naveen Nathan wrote: > > > > > 2. symmKeyInfo has the ASN1_OBJECT field 'usage'. If allocated using > > > symmKeyInfo_new(), how can I set the field? > > > > > > For example, 'payload' which is an ASN1_OCTET_STRING has available > > > ASN1_OCTET_STRING_set, which sets the field, reallocating 'payload' > > > if necessary. > > > > > > However digging through the openssl source I can't seem to find a > > > similar function for ASN1_OBJECT type. > > > > > > > That's because the ASN1_OBJECT is a little different. Some standard OIDs are > > set to a fixed value to avoid the need to keep allocating them. What that > > means in practice is you do something like: > > > > foo->usage = OBJ_something(somearg); > > > > This wont result in a memory leak because the OID isn't dynamically > > allocated. > > I would also be using custom OIDs. Would I need to first register the OIDs > using OBJ_create? Normally we don't use any name identifier. Or is there > a way to duplicate an ASN1_OBJECT? > > Otherwise I can probably write an auxillary function to handle this in > a similar vein to OBJ_dup(ASN1_OBJECT *). >
You can use OBJ_txt2obj to created an ASN1_OBJECT from the numerical form if you wish. OBJ_dup will duplicate an ASN1_OBJECT just fine. Steve. -- Dr Stephen N. Henson. OpenSSL project core developer. Commercial tech support now available see: http://www.openssl.org ______________________________________________________________________ OpenSSL Project http://www.openssl.org User Support Mailing List openssl-users@openssl.org Automated List Manager majord...@openssl.org