I have generated an ssh key with:
ssh-keygen -t rsa -b 4096
Resulting in this:
-----BEGIN OPENSSH PRIVATE KEY-----
...
-----END OPENSSH PRIVATE KEY-----
Now trying to generate a jwt
with this key:
import jwt
key = open("~/.ssh/id_rsa", "r").read()
token = jwt.encode(
claim={'iss': 'me'},
key=key,
algorithm='RS256'
)
I got the error:
ValueError: ('Could not deserialize key data. The data may be in an incorrect format, it may be encrypted with an unsupported algorithm, or it may be an unsupported key type (e.g. EC curves with explicit parameters).', [_OpenSSLErrorWithText(code=503841036, lib=60, reason=524556, reason_text=b'error:1E08010C:DECODER routines::unsupported')])
Is it not possible to use openSSH key to sign the data?