yubikey-manager-qt icon indicating copy to clipboard operation
yubikey-manager-qt copied to clipboard

Country name must be a 2 character country code

Open Torxed opened this issue 1 year ago • 2 comments

  • YubiKey Manager version: 5.2.1 / 1.2.5 (ui)
  • How was it installed?: pacman
  • Operating system and version: Arch Linux
  • YubiKey model and version: YubiKey NEO
  • Bug description summary: Country name must be a 2 character country code

Steps to reproduce

Applications -> PIV -> Card Authentication -> Generate CSR

Enter the subject string: C=SE/ST=StateName/L=CityName/O=CompanyName/OU=CompanySectionName/CN=Test

Expected result

For this window to produce the CSR at the specified location:

screenshot

Actual results

Failed to generate the CSR with the following stack trace:

Failed to open device
Traceback (most recent call last):
  File "qrc:///py/yubikey.py", line 78, in wrapped
    return f(*args, **kwargs)
           ^^^^^^^^^^^^^^^^^^
  File "qrc:///py/yubikey.py", line 632, in piv_generate_certificate
    csr = generate_csr(session,
          ^^^^^^^^^^^^^^^^^^^^^
  File "/usr/lib/python3.11/site-packages/ykman/piv.py", line 749, in generate_csr
    parse_rfc4514_string(subject_str)
  File "/usr/lib/python3.11/site-packages/ykman/piv.py", line 141, in parse_rfc4514_string
    parts.append(x509.NameAttribute(attr, v))
                 ^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/lib/python3.11/site-packages/cryptography/x509/name.py", line 142, in __init__
    raise ValueError(
ValueError: Country name must be a 2 character country code

Torxed avatar Jan 04 '24 13:01 Torxed

Try using , instead of / for the subject. In your case C=SE,ST=StateName,L=CityName,O=CompanyName,OU=CompanySectionName,CN=Test

fdennis avatar Jan 04 '24 13:01 fdennis

That worked. Is this intended behavior? As the praxis is / for most libraries and examples.

Torxed avatar Jan 04 '24 13:01 Torxed