[openssl-users] [EXTERNAL] Re: SOLVED --- ASN.1: Parsing a 'context-specific' class (or app/private class)

Sands, Daniel dnsands at sandia.gov
Wed Sep 2 16:36:40 UTC 2015


> Well at first sight that looks like an IMPLICIT tag which replaces
> the normal
> tag with the context specific value. It is not possible to determine
> the
> underlying type from the encoding itself as it has been replaced. So
> you need
> the ASN.1 spec to see the appropriate type to use.
> 
> In that particular example it looks like an SHA1 hash (20 bytes long)
> so we
> could use an implicitly tagged OCTET STRING like this:
> 
> 	ASN1_IMP(struct_name, field_name, ASN1_OCTET_STRING, 0),

And often, implicit tags are intended for ASN.1 Choice constructs so
that you will know which option of the choice to parse into.

If the OP knew exactly what was being parsed, most likely there's an
RFC that defines the structure exactly, which relieves one of needing
to reverse-engineer it.


More information about the openssl-users mailing list