From bf0a4c24256ec832ae3c6f43ba3c160c2596f600 Mon Sep 17 00:00:00 2001 From: Hayden Roche Date: Mon, 12 Sep 2022 20:05:26 -0700 Subject: [PATCH] Add optional hash_type parameter to RSA from_pem functions. --- wolfcrypt/ciphers.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/wolfcrypt/ciphers.py b/wolfcrypt/ciphers.py index c550677..005cf3f 100644 --- a/wolfcrypt/ciphers.py +++ b/wolfcrypt/ciphers.py @@ -521,9 +521,9 @@ if _lib.RSA_ENABLED: if _lib.ASN_ENABLED: @classmethod - def from_pem(cls, file): + def from_pem(cls, file, hash_type=None): der = pem_to_der(file, _lib.PUBLICKEY_TYPE) - return cls(der) + return cls(key=der, hash_type=hash_type) def encrypt(self, plaintext): """ @@ -670,9 +670,9 @@ if _lib.RSA_ENABLED: if _lib.ASN_ENABLED: @classmethod - def from_pem(cls, file): + def from_pem(cls, file, hash_type=None): der = pem_to_der(file, _lib.PRIVATEKEY_TYPE) - return cls(der) + return cls(key=der, hash_type=hash_type) if _lib.KEYGEN_ENABLED: def encode_key(self):