gbarr / perl-Convert-ASN1

encode/decode data using ASN.1 description
http://search.cpan.org/dist/Convert-ASN1/
13 stars 21 forks source link

BMPString data not fully decoded #29

Open tlhackque opened 8 years ago

tlhackque commented 8 years ago

At least in Microsoft CSRs, fields that are encoded as BMPString are returned by Convert:ASN1 as a string of octets (utf-8?) , apparently UCS2-BE. If "ABC" is encoded in the CSR, it comes out of Convert::ASN1 as "\0A\0B\0C".

Although it's possible to use Encode::decode('UCS2-BE', $value) to get a Perl-compatible string, Convert::ASN1 should be doing this before the string is returned.

Given the history, it may be necessary to enable the proper behavior with an option, since double decoding would corrupt the data.

Thanks.