> 
> Hello;
> 
> I'm attempting to convert a buffer containing a sequence of
> DER-encoded objects into a set of X509 objects.
> 
> The documentation for d2i_TYPE:
> 
>     TYPE *d2i_TYPE(a, pp, length)
>     TYPE **a;
>     unsigned char **pp;
>     long length; 
> 
> says that "*pp will be updated to point to *pp + length, so that d2i can be

"length" here is not parameter value but the size of object just decoded

> called
> repeatedly with the same arguments to process a block of DER-encoded objects."
> 
> However, I don't know what the length of each DER-encoded object is, so how
> can I pass in the proper value for "length" on each call to d2i_X509?

You need to pass the size of your buffer containing all der-encoded objects
in "length" parameter.

> Also, of
> what use is it to me for the routine to increment *pp, given that I would need
> to know "length" for each call anyway, and could therefore increment it
> myself?

One can keep *pp always pointing to original buffer right after the
last object decoded

> It seems to me that this routine should pass back the value of "length" for
> each DER-encoded object it finds in *pp.  I must be misunderstanding
> something.

There's lots of user's (well, developer's) habits, shortcuts..etc
based on this concept already so it's unlikey to get changed easily.
What for do you need length of der-decoded objects?

hope this helps,
Vadim Fedukovich
______________________________________________________________________
OpenSSL Project                                 http://www.openssl.org
Development Mailing List                       [EMAIL PROTECTED]
Automated List Manager                           [EMAIL PROTECTED]

Reply via email to