aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDavid Reid <dreid@dreid.org>2014-05-07 11:28:31 -0700
committerDavid Reid <dreid@dreid.org>2014-05-07 11:28:31 -0700
commitce15f99aeb904ac308717fa522784a8dfb22ce82 (patch)
tree71bbf246f22c3366a4c1fa68076552c673645a94
parent5f23ee8ac40a9bf76c08c9ebdbf4947a9e5158bc (diff)
downloadcryptography-ce15f99aeb904ac308717fa522784a8dfb22ce82.tar.gz
cryptography-ce15f99aeb904ac308717fa522784a8dfb22ce82.tar.bz2
cryptography-ce15f99aeb904ac308717fa522784a8dfb22ce82.zip
Use one error message for all integer typeerrors.
-rw-r--r--cryptography/hazmat/primitives/asymmetric/rsa.py35
1 files changed, 10 insertions, 25 deletions
diff --git a/cryptography/hazmat/primitives/asymmetric/rsa.py b/cryptography/hazmat/primitives/asymmetric/rsa.py
index 024f1103..b656d06c 100644
--- a/cryptography/hazmat/primitives/asymmetric/rsa.py
+++ b/cryptography/hazmat/primitives/asymmetric/rsa.py
@@ -262,32 +262,17 @@ class RSAPrivateKey(object):
class RSAPrivateNumbers(object):
def __init__(self, p, q, d, dmp1, dmq1, iqmp,
public_numbers):
- if not isinstance(p, six.integer_types):
- raise TypeError(
- "RSAPrivateNumbers' p argument must be an integer."
- )
- if not isinstance(q, six.integer_types):
- raise TypeError(
- "RSAPrivateNumbers' q argument must be an integer."
- )
-
- if not isinstance(d, six.integer_types):
- raise TypeError(
- "RSAPrivateNumbers' d argument must be an integer."
- )
-
- if not isinstance(dmp1, six.integer_types):
- raise TypeError(
- "RSAPrivateNumbers' dmp1 argument must be an integer."
- )
- if not isinstance(dmq1, six.integer_types):
- raise TypeError(
- "RSAPrivateNumbers' dmq1 argument must be an integer."
- )
-
- if not isinstance(iqmp, six.integer_types):
+ if (
+ not isinstance(p, six.integer_types) or
+ not isinstance(q, six.integer_types) or
+ not isinstance(d, six.integer_types) or
+ not isinstance(dmp1, six.integer_types) or
+ not isinstance(dmq1, six.integer_types) or
+ not isinstance(iqmp, six.integer_types)
+ ):
raise TypeError(
- "RSAPrivateNumbers' iqmp argument must be an integer."
+ "RSAPrivateNumbers' p, q, d, dmp1, dmq1, iqmp arguments must"
+ " all be an integers."
)
if not isinstance(public_numbers, RSAPublicNumbers):