diff options
author | Paul Kehrer <paul.l.kehrer@gmail.com> | 2014-03-11 08:34:28 -0400 |
---|---|---|
committer | Paul Kehrer <paul.l.kehrer@gmail.com> | 2014-03-11 08:34:28 -0400 |
commit | 08712cfb25227472d2586164b941f495d4c3b901 (patch) | |
tree | 05bc65e931c3836b2cd09662f5e77bfa14e6c67c | |
parent | db6fab5a02ec54edb6fe47b4f029a118b4dd26cd (diff) | |
download | cryptography-08712cfb25227472d2586164b941f495d4c3b901.tar.gz cryptography-08712cfb25227472d2586164b941f495d4c3b901.tar.bz2 cryptography-08712cfb25227472d2586164b941f495d4c3b901.zip |
change MAX_LENGTH to be an object rather than a byte string
-rw-r--r-- | cryptography/hazmat/primitives/asymmetric/padding.py | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/cryptography/hazmat/primitives/asymmetric/padding.py b/cryptography/hazmat/primitives/asymmetric/padding.py index df960b0f..62b32dd2 100644 --- a/cryptography/hazmat/primitives/asymmetric/padding.py +++ b/cryptography/hazmat/primitives/asymmetric/padding.py @@ -13,6 +13,8 @@ from __future__ import absolute_import, division, print_function +import collections + import six from cryptography import utils @@ -25,7 +27,7 @@ class PKCS1v15(object): class MGF1(object): - MAX_LENGTH = b"MAX_LENGTH" + MAX_LENGTH = collections.namedtuple("MAX_LENGTH", [])() def __init__(self, algorithm, salt_length): if not isinstance(algorithm, interfaces.HashAlgorithm): @@ -34,10 +36,10 @@ class MGF1(object): self.algorithm = algorithm if (not isinstance(salt_length, six.integer_types) and - salt_length != b"MAX_LENGTH"): + not salt_length is self.MAX_LENGTH): raise TypeError("salt_length must be an integer") - if salt_length != b"MAX_LENGTH" and salt_length < 0: + if not salt_length is self.MAX_LENGTH and salt_length < 0: raise ValueError("salt_length must be zero or greater") self.salt_length = salt_length |