custom asn1 structure - Openssl

This is a discussion on custom asn1 structure - Openssl ; Hello, I am trying to build a custom asn1 structure in my program using openssl 0.9.6. The structure will have a few sequences / sets with integers, printablestrings, etc. I am looking for some help on where to begin. I ...

+ Reply to Thread
Results 1 to 2 of 2

Thread: custom asn1 structure

  1. custom asn1 structure

    Hello,
    I am trying to build a custom asn1 structure in my program using openssl
    0.9.6.
    The structure will have a few sequences / sets with integers,
    printablestrings, etc.

    I am looking for some help on where to begin. I have been pouring over the
    openssl code, and have been playing with various methods of creating this
    ans1 structure but i haven't been able to create quite what i need.

    Are there some good examples out there too look at?

    Im currently doing things this way:

    create ASN1_STRING, ASN1_INTEGER..etc
    i2d all of them with null and get total size
    call ASN1_object_size(1,i,V_ASN1_SEQUENCE); to get total size.
    malloc new data size.
    i2d with newly malloc'd data.
    and finally
    ASN1_STRING_set(seq,data,total);

    But this does not really product what i need.
    I need something like:
    sequence
    set
    object objectname
    printable string string
    integer value

    Any help would be apreciated.


  2. Re: custom asn1 structure

    Thanks for the response. Unfortunately i cannot use any other version of
    openssl. Up until now i have been working with the methods provided by
    openssl as i described. i2d, ASN1* .

    But now you say i have to create 4 new functions. I dont think 0.9.6 follows
    the same nameing conventions as i dont see many *_asn1.c files.

    May there be any code that is doing something similar to what i want so i
    may take a look at?


    >
    > The first piece of advice if possible is DON'T. The ASN1 code changed
    > significantly in OpenSSL 0.9.7 and later and as a result it is much easier
    > to
    > write. All the old code had been rewritten in the new format with the odd
    > exception such as SSL_SESSION.
    >
    > In 0.9.7 there are numerous cases where the standard modules use ASN1 these
    > usually have the names *_asn1.c or *_asn.c . There are many (which don't
    > follow that naming convention) in crypto/x509v3.
    >
    > If you have to use 0.9.6 then look at the equivalent files. You have to
    > manually write 4 functions foo_new(), foo_free(), i2d_foo() and d2i_foo()
    > using macros from asn1_mac.h .
    >
    > Steve.
    > --
    > Dr Stephen N. Henson. Email, S/MIME and PGP keys: see homepage
    > OpenSSL project core developer and freelance consultant.
    > 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 majordomo@openssl.org
    >



+ Reply to Thread