UnrecognizedExtension
constructor does not DER encode data
#9937
Labels
waiting-on-reporter
Issue is waiting on a reply from the reporter. It will be automatically cloesd if there is no reply.
Versions of:
cryptography
: 41.0.5cffi
,pip
, andsetuptools
: (immaterial, imho)How you installed
cryptography
pip install cryptography
Clear steps for reproducing your bug
The output does not represent the DER encoded version of the byte string
b"abc"
(which I would have expected, according to the docs).If I add this extension to a CSR or (presumably, although I haven't tried that yet) a certificate, serialize the CSR, and view the hex dump, I see the extension encoded as an OCTET STREAM (tag 0x04):
(note the
04 0361 6263
embedded in the hex dump).It seems like #9283 might get me closer to what I want, but I'm not sure.
It would be nice if I could provide
b"\x04\x03abc"
in the constructor forUnrecognizedExtension
and have that be serialized unmodified.It would be nicer if, should I provide a byte string in the constructor, it would be serialized as an OCTET STREAM, but if I were to provide a regular string in the constructor, it would be serialized as a UTF8String.
It would be amazingly nice if, should I provide a pure ASCII string, it would be serialized as a PrintableString, but only on alternate Tuesdays when the code knew that was what I wanted... okay, I guess I'm asking for too much there.
But perhaps a better alternative would be to examine the tag and length fields of a byte string, and if the length matches the length of the string, and the tag is reasonable (or perhaps even ignore the tag), accept the byte string as already having been DER encoded.
Right now, I'm kinda stuck, as I'm not sure how to embed a custom PrintableString extension in my CRL or cert.
The text was updated successfully, but these errors were encountered: