Hi

I think I didn't make myself clear about my problem in the last message. I
have the DER encoded value (byte [] (03:7C:02:01...) of the whole ASN1
Object that corresponds to the SEQUENCE with 3 elements

> 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...

This structures corresponds to a version, digest algorithm and message
digest. I would like to read each of these values separately. In particular.
I want to get the message digest and digest algorithm. Is there any methods
in open ssl that I can use to get these values?

I tired using ASN1_seq_unpack_ASN1_TYPE and I could see that the structure
has 3 elements. But the value (sk_value) for each element doesn't seem to be
corresponding to the values of the above sequence. How to do get the values
inside the structure? Please help.

Thanks

Regards,
Venkata


-----Original Message-----
From: Venkata Sairam [mailto:[EMAIL PROTECTED]
Sent: Monday, December 05, 2005 10:27 AM
To: 'openssl-users@openssl.org'
Subject: RE: ASN1 parsing


Hi

I am still stuck in the implementation of the ASN1 module for the data. I am
kinda lost. Can anyone provide some insights about implementing the ASN1
parser for the data below.

> 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...

Thanks

Regards,
Venkat

-----Original Message-----
From: Venkata Sairam [mailto:[EMAIL PROTECTED]
Sent: Friday, December 02, 2005 10:57 AM
To: 'openssl-users@openssl.org'
Subject: RE: ASN1 parsing


Hi

Thanks for the reply.

I will try to implement a ASN1 module for the data. I am new to openssl and
tried to get some sample code but couldn't find any. Can you please point me
to few sample examples of  the implementation (may be one simple and one
complex one)?

Thanks once again.

-Venkat
-----Original Message-----
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] Behalf Of Dr. Stephen Henson
Sent: Thursday, December 01, 2005 10:27 PM
To: openssl-users@openssl.org
Subject: Re: ASN1 parsing


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]

______________________________________________________________________
OpenSSL Project                                 http://www.openssl.org
User Support Mailing List                    openssl-users@openssl.org
Automated List Manager                           [EMAIL PROTECTED]

Reply via email to