Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Country name must be a 2 character country code #353

Open
Torxed opened this issue Jan 4, 2024 · 2 comments
Open

Country name must be a 2 character country code #353

Torxed opened this issue Jan 4, 2024 · 2 comments

Comments

@Torxed
Copy link

Torxed commented Jan 4, 2024

  • 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
@fdennis
Copy link
Contributor

fdennis commented Jan 4, 2024

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

@Torxed
Copy link
Author

Torxed commented Jan 4, 2024

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

No branches or pull requests

2 participants