extnValue [UNIVERSAL 4] EXPLICIT ANY DEFINED BY extnID
But that causes a parse error as it is expecting the tag to have the constructor bit set :(
Maybe I could add an extension so we can write
extnValue [UNIVERSAL 4] CONTAINING ANY DEFINED BY extnID
Which is identical to explicit, but does not set the constructor bit
'ANY DEFINED BY' just encodes the actual value in place of the 'ANY', as far
as I know. This X.509 stuff is different - it encodes the value and then
encodes a real OCTET STRING containing the encoded value.
I know, and that is basically what EXPLICIT does. C::ASN1 already accepts the syntax above, but it sets the constructor bit. CONTAINING would be a way around it.
Either way, you'd need some sort of way to map from the OID to the syntax
definition of the ANY, or in this case of the thing embedded inside the
OCTET STRING. Apparently ASN.1 EXTERNAL lets you embed things inside BIT
STRINGs too, just to be flexible.
So you need to hold a mapping table for the OIDs <-> Type, and a way to define how the inner thing is embedded.
The code todo that is already in C::ASN1, you do it like
$asn->registeroid('2.5.29.17' => $asn->find('SubjectAltName'));
Take a look in t/14any.t in the distribution
Graham.