x509 certificate decoded string representation is wrong

Daniel Goertzen <[email protected]>
Newsgroups gmane.comp.lang.erlang.bugs
Message-ID <CAJCf5RwEEAtvKouajhqqkGEjM6Sf3oYXD1PEMvEKPmh_+JWyuA@mail.gmail.com>
In the public_key application, decoding of attributes in x509 certificates
does not always decode to a string as indicated in the documentation.  The
documentation says that the value of commonName (and several other
attributes) should be:

special_string() = {teletexString, string()} | {printableString, string()}
| {universalString, string()} | {utf8String, string()} | {bmpString,
string()}

... however when I decode a cert I see a utf8String coming out as a binary
instead of a string()....

[{'AttributeTypeAndValue',
  {2,5,4,3},
    {utf8String,<<"Daniel Goertzen">>}}],

... and typer shows several other non-string representations (unicode
characters represented by 4-tuples):

-spec dec_X520CommonName(_) ->
{'bmpString',[byte() | {byte(),byte(),byte(),byte()}] | {byte(),binary()}} |
{'printableString',[byte() | {byte(),byte(),byte(),byte()}] |
{byte(),binary()}} |
{'teletexString',[byte() | {byte(),byte(),byte(),byte()}] |
{byte(),binary()}} |
{'universalString',[byte() | {byte(),byte(),byte(),byte()}] |
{byte(),binary()}} |
{'utf8String',_}.



Also, encoding does not accept unicode strings (list of chars).  The
example below crashes.

    Subject = {rdnSequence, [
        [#'AttributeTypeAndValue'{
            type  = ?'id-at-commonName',
            value = {utf8String, [16#4e09|" string starting with a chinese
symbol"]}
        }]
    ]},



I assume that the documentation is right and the decoded representation
should be "list of characters".  Instead internal representations are
coming through.

_______________________________________________
erlang-bugs mailing list
[email protected]
http://erlang.org/mailman/listinfo/erlang-bugs
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.