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

The key generation example in this repo is not working any more #18

Open
FoamyGuy opened this issue Feb 27, 2025 · 0 comments
Open

The key generation example in this repo is not working any more #18

FoamyGuy opened this issue Feb 27, 2025 · 0 comments

Comments

@FoamyGuy
Copy link
Contributor

It raises this exception:

writing RSA key
Traceback (most recent call last):
  File "Adafruit_CircuitPython_JWT/examples/jwt_simpletest_secrets.py", line 37, in <module>
    pk = rsa.PrivateKey.load_pkcs1(private_key)
         ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File ".cpy_venv/lib/python3.12/site-packages/rsa/key.py", line 125, in load_pkcs1
    return method(keyfile)
           ^^^^^^^^^^^^^^^
  File ".cpy_venv/lib/python3.12/site-packages/rsa/key.py", line 612, in _load_pkcs1_pem
    der = rsa.pem.load_pem(keyfile, b"RSA PRIVATE KEY")
          ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File ".cpy_venv/lib/python3.12/site-packages/rsa/pem.py", line 103, in load_pem
    pem_lines = [line for line in _pem_lines(contents, pem_start, pem_end)]
                ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File ".cpy_venv/lib/python3.12/site-packages/rsa/pem.py", line 77, in _pem_lines
    raise ValueError('No PEM start marker "%r" found' % pem_start)
ValueError: No PEM start marker "b'-----BEGIN RSA PRIVATE KEY-----'" found

The private key that was generated begins with -----BEGIN PRIVATE KEY-----, note the lack of "RSA". I'm guessing that my version of openssl is newer than what this example or the library it uses were written for.

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

No branches or pull requests

1 participant