Here's how RFC 5280 defines an X.509 extension field:
Extension ::= SEQUENCE {
extnID OBJECT IDENTIFIER,
critical BOOLEAN DEFAULT FALSE,
extnValue OCTET STRING
-- contains the DER encoding of an ASN.1 value
-- corresponding to the extension type identified
-- by extnID
}
When I use the pyasn1 decoder, I'll get an object foo
whose foo['extnValue'].asOctets()
can be further decoded, with another call to the decoder, using the schema appropriate to foo['extnID']
.
Question: supposing that there's one special extnID
in my application, is it possible in pyasn1 to define a schema that (a) doesn't accept any OBJECT IDENTIFIER, only the special one; and (b) steps past the OCTET STRING wrapper to decode the payload according to the appropriate special "sub-schema" ?
I can do this by special-case logic in the code, but I'd prefer to define a special-case schema if that is supported.