Skip to content

Commit

Permalink
Merge pull request #65 from Allu2/master
Browse files Browse the repository at this point in the history
Allow importing password protected pem files
  • Loading branch information
rohe authored Sep 16, 2016
2 parents 1c4398b + 77ad596 commit dcc51ca
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions src/jwkest/jwk.py
Original file line number Diff line number Diff line change
Expand Up @@ -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):
Expand Down

0 comments on commit dcc51ca

Please sign in to comment.