Hi all,

I am trying to parse a sequence that has, after an integer, a 'private' (xclass) item. I was wondering what is the right templates / macros to be able to generate the ASN1 functions with the usual macro. An example of the structure I have to parse (B64 - DER), is the following:

MGICAQOAFGZKq8/wIYS7Iueq6NuaC3ESPqUKMAkGBSsOAwIaBQAwCwYHKoZIzjgEAQUABC8wLQIVAJTJ6W2QjBIbVQdAtLbPO3y1wazHAhRsXivNO/Eg4GMEgcmEx8OgsIxGzQ==

[ you can paste it into http://www.lapo.it/asn1js/ to get useful info. ]

The field that is giving me issues is the 2nd field in the sequence - offest 5, length 20 (i.e., after SEQUENCE (2 bytes) + INTEGER (3 bytes) and then the 20bytes field that I want to parse). The type is 0x80 - context specific. By using the ASN1_get_object() function, I get the correct size (20), the tag (0), and the xclass (128). Now, how do I go in order to generate the useful ASN1 function with teh usual macros ? Here's an example (besides the second field) for what I am trying to do:

ASN1_SEQUENCE(TYPE) = {

    ASN1_SIMPLE(TYPE, field1, ASN1_INTEGER),

    XXXXXXX(TYPE, field2, YYYYY),                      <<-- What shall be used 
here ? What Macro ?

    ASN1_SEQUENCE_OF(TYPE, field3, ASN1_OBJECT),

    ASN1_SEQUENCE_OF(TYPE, field3, ASN1_OBJECT),

    ASN1_SIMPLE(TYPE, field3, ASN1_OCTET_STRING)       <<-- This might be wrong 
as well - just noticed it is a very

} ASN1_SEQUENCE_END(TYPE)                                    weird encoding 
(octet-string that encapsulates a sequence of integers)


Is there a way to have the macros do the work (e.g., shall I use other macros - template? - to define the field somehow) ? Or shall I just write my own d2i_ and i2d_ functions ?

Please let me know,

Cheers,
Max

_______________________________________________
openssl-users mailing list
To unsubscribe: https://mta.openssl.org/mailman/listinfo/openssl-users

Reply via email to