On Thu, Dec 01, 2005, Venkata Sairam wrote:

> Hi
> 
> I am trying to parse a ASN format that has the following structure.
> ASNSEQUENCE[C] = 3 elements
>   INTEGER = 0
>   SEQUENCE[C] = 2 elements
>     OBJECT ID = SHA
>     NULL = null
>   SEQUENCE[C] = 1 elements
>     SEQUENCE[C] = 2 elements
>       INTEGER = 1
>       OCTET STRING = 20 bytes: 98:F7:6A:06:E1...
> 
> My input is der encoding of this structure.
> 
> I am not sure how to correctly read all the elements inside a SEQUENCE. In
> particular, I want to read the digest and the digest algorithm.
>  I tried using the method ASN1_seq_unpack_ASN1_TYPE. Can anyone provide
> sample codes or provide an explanation on how to parse?
> 

The easiest thing to do is to write an ASN1 module for the data. There are
examples of varying complexity all over OpenSSL. Do a grep for ASN1_SEQUENCE
in the source.

Some of that structure looks like it uses some standard structures. For
example the second SEQUENCE looks like a DigestAlgorithmIdentifier which is
the type X509_ALGOR in OpenSSL.

Steve.
--
Dr Stephen N. Henson. Email, S/MIME and PGP keys: see homepage
OpenSSL project core developer and freelance consultant.
Funding needed! Details on homepage.
Homepage: http://www.drh-consultancy.demon.co.uk
______________________________________________________________________
OpenSSL Project                                 http://www.openssl.org
User Support Mailing List                    openssl-users@openssl.org
Automated List Manager                           [EMAIL PROTECTED]

Reply via email to