Re: A few questions about custom ASN1

2012-04-04 Thread Dr. Stephen Henson
On Tue, Apr 03, 2012, Naveen Nathan wrote: On Wed, Apr 04, 2012 at 03:12:26AM +0200, Dr. Stephen Henson wrote: On Tue, Apr 03, 2012, Naveen Nathan wrote: That's because the ASN1_OBJECT is a little different. Some standard OIDs are set to a fixed value to avoid the need to

A few questions about custom ASN1

2012-04-03 Thread Naveen Nathan
Hi, I'm trying to use the custom ASN1 facilities of openssl, but lack understanding of some aspects. At the end of I've included some test source code which attempts to encode and write out a custom ASN1 structure. Regarding the code I have a few questions: 1. Does symmKeyInfo_new(), where

Re: A few questions about custom ASN1

2012-04-03 Thread Dr. Stephen Henson
On Tue, Apr 03, 2012, Naveen Nathan wrote: Hi, I'm trying to use the custom ASN1 facilities of openssl, but lack understanding of some aspects. At the end of I've included some test source code which attempts to encode and write out a custom ASN1 structure. Regarding the code I have a few

Re: A few questions about custom ASN1

2012-04-03 Thread Naveen Nathan
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.

Re: A few questions about custom ASN1

2012-04-03 Thread Dr. Stephen Henson
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,

Re: A few questions about custom ASN1

2012-04-03 Thread Naveen Nathan
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

Re: A few questions about custom ASN1

2012-04-03 Thread Dr. Stephen Henson
On Tue, Apr 03, 2012, Naveen Nathan wrote: 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 =

Re: A few questions about custom ASN1

2012-04-03 Thread Naveen Nathan
On Wed, Apr 04, 2012 at 03:12:26AM +0200, Dr. Stephen Henson wrote: On Tue, Apr 03, 2012, Naveen Nathan wrote: 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