how to decode/encode X509_ALGOR.parameter?

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
4 messages Options
Reply | Threaded
Open this post in threaded view
|

how to decode/encode X509_ALGOR.parameter?

Szabolcs Berecz
Hi!

I can 'decode' it by hand and I could 'encode' it, too, but I'm sure
there is a better way.
Could you tell me where to look in the openssl source?

Szabi
______________________________________________________________________
OpenSSL Project                                 http://www.openssl.org
User Support Mailing List                    [hidden email]
Automated List Manager                           [hidden email]
Reply | Threaded
Open this post in threaded view
|

Re: how to decode/encode X509_ALGOR.parameter?

Dr. Stephen Henson
On Thu, Jan 12, 2006, Szabolcs Berecz wrote:

> Hi!
>
> I can 'decode' it by hand and I could 'encode' it, too, but I'm sure
> there is a better way.
> Could you tell me where to look in the openssl source?
>

This is represented as the ASN1_TYPE structure which is roughly equivalent to
the ASN1 "ANY" type. Universally tagged simple types are represented in the
ASN1_TYPE structure itself.

Structured types or those which aren't univerally tagged have their entire
encoding repretsent in the ASN1_TYPE structure.

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                    [hidden email]
Automated List Manager                           [hidden email]
Reply | Threaded
Open this post in threaded view
|

Re: how to decode/encode X509_ALGOR.parameter?

Szabolcs Berecz
Ok, but how can I create a sequence?

I have to create this structure and convert to DER:
sequence {
    integer
    octetstring
}

For integer I can use ASN1_INTEGER_new, ASN1_INTEGER_set and
i2d_ASN1_INTEGER. The same for octetstring. But how can I put these in
a sequence?

Could you please write a code snippet which shows how to create this sequence?
I would really appreciate it.

Szabi

On 12/01/06, Dr. Stephen Henson <[hidden email]> wrote:

> On Thu, Jan 12, 2006, Szabolcs Berecz wrote:
>
> > Hi!
> >
> > I can 'decode' it by hand and I could 'encode' it, too, but I'm sure
> > there is a better way.
> > Could you tell me where to look in the openssl source?
> >
>
> This is represented as the ASN1_TYPE structure which is roughly equivalent to
> the ASN1 "ANY" type. Universally tagged simple types are represented in the
> ASN1_TYPE structure itself.
>
> Structured types or those which aren't univerally tagged have their entire
> encoding repretsent in the ASN1_TYPE structure.
>
> 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                    [hidden email]
> Automated List Manager                           [hidden email]
>
______________________________________________________________________
OpenSSL Project                                 http://www.openssl.org
User Support Mailing List                    [hidden email]
Automated List Manager                           [hidden email]
Reply | Threaded
Open this post in threaded view
|

Re: how to decode/encode X509_ALGOR.parameter?

Dr. Stephen Henson
On Thu, Jan 12, 2006, Szabolcs Berecz wrote:

> Ok, but how can I create a sequence?
>
> I have to create this structure and convert to DER:
> sequence {
>     integer
>     octetstring
> }
>
> For integer I can use ASN1_INTEGER_new, ASN1_INTEGER_set and
> i2d_ASN1_INTEGER. The same for octetstring. But how can I put these in
> a sequence?
>

Well the usual way is to write an ASN1 module, there are loads of examples of
those in OpenSSL.

However in this case there's actually a function that does it already called
ASN1_TYPE_set_int_octetstring().

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                    [hidden email]
Automated List Manager                           [hidden email]