[openssl-users] [EXTERNAL] Re: SOLVED --- ASN.1: Parsing a 'context-specific' class (or app/private class)
Dr. Stephen Henson
steve at openssl.org
Wed Sep 2 17:26:15 UTC 2015
On Wed, Sep 02, 2015, Sands, Daniel wrote:
> > 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.
>
Or OPTIONAL and occasionally one does see tagged types for no apparent reason.
Also just because you see a universal tag doesn't mean that it isn't part of
a CHOICE: which would mean the parser would choke when it encountered an
unexpected tag.
Steve.
--
Dr Stephen N. Henson. OpenSSL project core developer.
Commercial tech support now available see: http://www.openssl.org
More information about the openssl-users
mailing list