diff --git a/src/jwkest/jwk.py b/src/jwkest/jwk.py index 222f1ee..6c79b2a 100644 --- a/src/jwkest/jwk.py +++ b/src/jwkest/jwk.py @@ -87,18 +87,18 @@ def sha512_digest(msg): # ============================================================================= -def import_rsa_key_from_file(filename): - return RSA.importKey(open(filename, 'r').read()) +def import_rsa_key_from_file(filename, passphrase=None): + return RSA.importKey(open(filename, 'r').read(), passphrase=passphrase) -def import_rsa_key(key): +def import_rsa_key(key, passphrase=None): """ Extract an RSA key from a PEM-encoded certificate - :param key: RSA key encoded in standard form + :param passphrase: Password to open the certificate (Optional) :return: RSA key instance """ - return importKey(key) + return importKey(key, passphrase=passphrase) def der2rsa(der):