aboutsummaryrefslogtreecommitdiffstats
path: root/cryptography
diff options
context:
space:
mode:
authorAlex Stapleton <alexs@prol.etari.at>2014-07-08 15:32:35 +0100
committerAlex Stapleton <alexs@prol.etari.at>2014-07-08 15:32:35 +0100
commitab8d3eb82b9faaf1d3a2792cf4a10cc054b86165 (patch)
tree817657e96f2fb7e7a90239af1682c9914623822d /cryptography
parente5ac40c01af9a5e326217a4231fc917f05154889 (diff)
parent1658f948a5641d27a50f09dbd7b1cbf44408c34e (diff)
downloadcryptography-ab8d3eb82b9faaf1d3a2792cf4a10cc054b86165.tar.gz
cryptography-ab8d3eb82b9faaf1d3a2792cf4a10cc054b86165.tar.bz2
cryptography-ab8d3eb82b9faaf1d3a2792cf4a10cc054b86165.zip
Merge pull request #1225 from alex/deprecation
Advanced and remove the deprecated MGF1 sale length code
Diffstat (limited to 'cryptography')
-rw-r--r--cryptography/hazmat/backends/openssl/rsa.py5
-rw-r--r--cryptography/hazmat/primitives/asymmetric/padding.py43
-rw-r--r--cryptography/utils.py3
3 files changed, 9 insertions, 42 deletions
diff --git a/cryptography/hazmat/backends/openssl/rsa.py b/cryptography/hazmat/backends/openssl/rsa.py
index 6f28c541..21ac1573 100644
--- a/cryptography/hazmat/backends/openssl/rsa.py
+++ b/cryptography/hazmat/backends/openssl/rsa.py
@@ -30,10 +30,7 @@ from cryptography.hazmat.primitives.interfaces import (
def _get_rsa_pss_salt_length(pss, key_size, digest_size):
- if pss._mgf._salt_length is not None:
- salt = pss._mgf._salt_length
- else:
- salt = pss._salt_length
+ salt = pss._salt_length
if salt is MGF1.MAX_LENGTH or salt is PSS.MAX_LENGTH:
# bit length - 1 per RFC 3447
diff --git a/cryptography/hazmat/primitives/asymmetric/padding.py b/cryptography/hazmat/primitives/asymmetric/padding.py
index d44bbda5..3967e065 100644
--- a/cryptography/hazmat/primitives/asymmetric/padding.py
+++ b/cryptography/hazmat/primitives/asymmetric/padding.py
@@ -13,8 +13,6 @@
from __future__ import absolute_import, division, print_function
-import warnings
-
import six
from cryptography import utils
@@ -31,26 +29,15 @@ class PSS(object):
MAX_LENGTH = object()
name = "EMSA-PSS"
- def __init__(self, mgf, salt_length=None):
+ def __init__(self, mgf, salt_length):
self._mgf = mgf
- if salt_length is None:
- warnings.warn(
- "salt_length is deprecated on MGF1 and should be added via the"
- " PSS constructor.",
- utils.DeprecatedIn04,
- stacklevel=2
- )
- else:
- if (not isinstance(salt_length, six.integer_types) and
- salt_length is not self.MAX_LENGTH):
- raise TypeError("salt_length must be an integer.")
-
- if salt_length is not self.MAX_LENGTH and salt_length < 0:
- raise ValueError("salt_length must be zero or greater.")
+ if (not isinstance(salt_length, six.integer_types) and
+ salt_length is not self.MAX_LENGTH):
+ raise TypeError("salt_length must be an integer.")
- if salt_length is None and self._mgf._salt_length is None:
- raise ValueError("You must supply salt_length.")
+ if salt_length is not self.MAX_LENGTH and salt_length < 0:
+ raise ValueError("salt_length must be zero or greater.")
self._salt_length = salt_length
@@ -71,24 +58,8 @@ class OAEP(object):
class MGF1(object):
MAX_LENGTH = object()
- def __init__(self, algorithm, salt_length=None):
+ def __init__(self, algorithm):
if not isinstance(algorithm, interfaces.HashAlgorithm):
raise TypeError("Expected instance of interfaces.HashAlgorithm.")
self._algorithm = algorithm
-
- if salt_length is not None:
- warnings.warn(
- "salt_length is deprecated on MGF1 and should be passed to "
- "the PSS constructor instead.",
- utils.DeprecatedIn04,
- stacklevel=2
- )
- if (not isinstance(salt_length, six.integer_types) and
- salt_length is not self.MAX_LENGTH):
- raise TypeError("salt_length must be an integer.")
-
- if salt_length is not self.MAX_LENGTH and salt_length < 0:
- raise ValueError("salt_length must be zero or greater.")
-
- self._salt_length = salt_length
diff --git a/cryptography/utils.py b/cryptography/utils.py
index 1db16151..9c574085 100644
--- a/cryptography/utils.py
+++ b/cryptography/utils.py
@@ -16,8 +16,7 @@ from __future__ import absolute_import, division, print_function
import sys
-DeprecatedIn04 = DeprecationWarning
-DeprecatedIn05 = PendingDeprecationWarning
+DeprecatedIn05 = DeprecationWarning
def register_interface(iface):