Open stbuehler opened 7 years ago
I looked it up in X.690 (08/2015):
BIT STRING
:
NOTE 2 – In particular, the tags in the contents octets are always universal class, number 3.
OCTET STRING
:
NOTE 2 – In particular, the tags in the contents octets are always universal class, number 4.
$op
and using cTYPE
for the inner tag) works for most strings (as they use opSTRING
(4) for cTYPE
)UTF8String
/ opUTF8
BCDString
(opBCD
) might be broken too
Hi,
given the following ASN.1 definition:
it seems the following input should be allowed:
(At least I see this happening in
EncryptedContent
inCMS
messages; openssl usesASN1_OCTET_STRING_NDEF
for this special case).Convert::ASN1
passes the$op
for the outer (possibly constructed) data to the recursion for the inner handling, but doesn't replace the[0]
tag with the primitive type (4
), see _decode.pm:L86.But the inner
OCTET STRING
s aren't tagged with[0]
, they use their primitive type.One could try to duplicate the
$op
and replace the tag with the type, and pass that to the recursion:If I knew I'd always get "chunked" values, I could simply write
instead... - but this is probably not the case, and I couldn't get a CHOICE working yet either.
Test case looks like this: