Skip to content

RSA import fail #60

Closed
Closed
@jschlyter

Description

@jschlyter

With the latest cryptography (3.1), something is rotten in the state of RSA. Previous version of cryptography (3.0) works like a charm.

from cryptojwt.key_bundle import KeyBundle
from cryptojwt.jwk.rsa import new_rsa_key, RSAKey
from cryptojwt.jwk.jwk import key_from_jwk_dict

key = new_rsa_key(key_size=2048)
jwk_dict = key.serialize(private=True)

k1 = key_from_jwk_dict(jwk_dict)
print(k1)

k2 = RSAKey(**jwk_dict)
print(k2)

key_from_jwk_dict works but, RSAKey does not:

ValueError: ('Invalid private key', [_OpenSSLErrorWithText(code=67764350, lib=4, func=160, reason=126, reason_text=b'error:040A007E:rsa routines:RSA_check_key_ex:iqmp not inverse of q')])

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions