aboutsummaryrefslogtreecommitdiffstats
path: root/cryptography
diff options
context:
space:
mode:
authorPaul Kehrer <paul.l.kehrer@gmail.com>2014-04-02 17:48:01 -0500
committerPaul Kehrer <paul.l.kehrer@gmail.com>2014-04-02 21:28:53 -0500
commitc9a879350d46581d69d51732d18579defd78072f (patch)
treeefe0323956f716642532d7f12a89ddcf5d2e52cd /cryptography
parentba987453e648f6c40023c42524d11a4d568fcf99 (diff)
downloadcryptography-c9a879350d46581d69d51732d18579defd78072f.tar.gz
cryptography-c9a879350d46581d69d51732d18579defd78072f.tar.bz2
cryptography-c9a879350d46581d69d51732d18579defd78072f.zip
address review comments
Diffstat (limited to 'cryptography')
-rw-r--r--cryptography/exceptions.py3
-rw-r--r--cryptography/hazmat/primitives/asymmetric/padding.py13
2 files changed, 11 insertions, 5 deletions
diff --git a/cryptography/exceptions.py b/cryptography/exceptions.py
index b4ee8feb..b3c6ca7b 100644
--- a/cryptography/exceptions.py
+++ b/cryptography/exceptions.py
@@ -59,3 +59,6 @@ class InvalidKey(Exception):
class InvalidToken(Exception):
pass
+
+
+DeprecatedIn04 = PendingDeprecationWarning
diff --git a/cryptography/hazmat/primitives/asymmetric/padding.py b/cryptography/hazmat/primitives/asymmetric/padding.py
index 8a1929bb..932c2e29 100644
--- a/cryptography/hazmat/primitives/asymmetric/padding.py
+++ b/cryptography/hazmat/primitives/asymmetric/padding.py
@@ -17,7 +17,7 @@ import warnings
import six
-from cryptography import utils
+from cryptography import exceptions, utils
from cryptography.hazmat.primitives import interfaces
@@ -38,7 +38,7 @@ class PSS(object):
warnings.warn(
"salt_length is deprecated on MGF1 and should be added via the"
" PSS constructor.",
- PendingDeprecationWarning
+ exceptions.DeprecatedIn04
)
else:
if (not isinstance(salt_length, six.integer_types) and
@@ -48,6 +48,9 @@ class PSS(object):
if salt_length is not self.MAX_LENGTH and salt_length < 0:
raise ValueError("salt_length must be zero or greater")
+ if salt_length is None and self._mgf._salt_length is None:
+ raise ValueError("You must supply salt_length")
+
self._salt_length = salt_length
@@ -62,9 +65,9 @@ class MGF1(object):
if salt_length is not None:
warnings.warn(
- "salt_length is deprecated on MGF1 and should be added via the"
- " PSS constructor.",
- PendingDeprecationWarning
+ "salt_length is deprecated on MGF1 and should be passed to "
+ "the PSS constructor instead.",
+ exceptions.DeprecatedIn04
)
if (not isinstance(salt_length, six.integer_types) and
salt_length is not self.MAX_LENGTH):