Skip to content

Commit bf0a4c2

Browse files
haydenroche5danielinux
authored andcommitted
Add optional hash_type parameter to RSA from_pem functions.
1 parent 3569bb7 commit bf0a4c2

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

wolfcrypt/ciphers.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -521,9 +521,9 @@ def __init__(self, key=None, hash_type=None):
521521

522522
if _lib.ASN_ENABLED:
523523
@classmethod
524-
def from_pem(cls, file):
524+
def from_pem(cls, file, hash_type=None):
525525
der = pem_to_der(file, _lib.PUBLICKEY_TYPE)
526-
return cls(der)
526+
return cls(key=der, hash_type=hash_type)
527527

528528
def encrypt(self, plaintext):
529529
"""
@@ -670,9 +670,9 @@ def __init__(self, key=None, hash_type=None): # pylint: disable=super-init-not-
670670

671671
if _lib.ASN_ENABLED:
672672
@classmethod
673-
def from_pem(cls, file):
673+
def from_pem(cls, file, hash_type=None):
674674
der = pem_to_der(file, _lib.PRIVATEKEY_TYPE)
675-
return cls(der)
675+
return cls(key=der, hash_type=hash_type)
676676

677677
if _lib.KEYGEN_ENABLED:
678678
def encode_key(self):

0 commit comments

Comments
 (0)