voltone / x509

Elixir package for working with X.509 certificates, Certificate Signing Requests (CSRs), Certificate Revocation Lists (CRLs) and RSA/ECC key pairs
BSD 3-Clause "New" or "Revised" License
120 stars 28 forks source link

Parsing attributes of encoding 'teletexString' #29

Closed hrivks closed 5 years ago

hrivks commented 5 years ago

This follows from https://github.com/voltone/x509/issues/26 (and thanks for fixing that so quickly)

Apparently, attributes could have encoding of type 'teletexString'. Refer: https://github.com/erlang/otp/blob/master/lib/public_key/src/public_key.erl#L1593

Currently, it fails to parse with error:

** (FunctionClauseError) no function clause matching in List.to_string/1
bash[500]:  (elixir) lib/list.ex:883: List.to_string({:teletexString, 'www.entrust.net/CPS_2048 incorp. by ref. (limits liab.)'})

I guess this too has to be handled here: https://github.com/voltone/x509/blob/master/lib/x509/rdn_sequence.ex#L283

Thank you for your time.

voltone commented 5 years ago

The spec allows for even more character sets, but I had hoped the more obscure ones had died out in the wild.

Another case clause would work for 7-bit characters, but for 8-bit code points a mapping function would be needed. Have you seen teletexString elsewhere, in places where special (accented) characters might be important?

hrivks commented 5 years ago

Unfortunately, it came up in production. I've not seen teletexString before and I think the importance of accented characters is subjective (to me personally, I couldn't care less).

voltone commented 5 years ago

Fixed in v0.7.0 (7-bit values only, at least for now). Thanks for the report!

hrivks commented 5 years ago

thank you very much