Skip to content

Commit 6f03385

Browse files
DataGhostDataGhost
andauthored
Added possibility to call jwk.construct() with a private key (#295)
Co-authored-by: DataGhost <[email protected]>
1 parent 2f0aca6 commit 6f03385

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

jose/backends/cryptography_backend.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -228,8 +228,8 @@ def __init__(self, key, algorithm, cryptography_backend=default_backend):
228228

229229
self.cryptography_backend = cryptography_backend
230230

231-
# if it conforms to RSAPublicKey interface
232-
if hasattr(key, "public_bytes") and hasattr(key, "public_numbers"):
231+
# if it conforms to RSAPublicKey or RSAPrivateKey interface
232+
if (hasattr(key, "public_bytes") and hasattr(key, "public_numbers")) or hasattr(key, "private_bytes"):
233233
self.prepared_key = key
234234
return
235235

0 commit comments

Comments
 (0)