Give slightly better error messages from rsa key validation failure

This commit is contained in:
Jean-Paul Calderone 2023-01-03 10:28:59 -05:00
parent 23f2d8b019
commit f6d9c33526

View File

@ -176,7 +176,7 @@ def _validate_public_key(public_key: PublicKey) -> None:
""" """
if not isinstance(public_key, rsa.RSAPublicKey): if not isinstance(public_key, rsa.RSAPublicKey):
raise ValueError( raise ValueError(
"public_key must be an RSAPublicKey" f"public_key must be an RSAPublicKey not {type(public_key)}"
) )
@ -187,5 +187,5 @@ def _validate_private_key(private_key: PrivateKey) -> None:
""" """
if not isinstance(private_key, rsa.RSAPrivateKey): if not isinstance(private_key, rsa.RSAPrivateKey):
raise ValueError( raise ValueError(
"private_key must be an RSAPrivateKey" f"private_key must be an RSAPrivateKey not {type(private_key)}"
) )