aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--cryptography/hazmat/backends/interfaces.py8
-rw-r--r--cryptography/hazmat/backends/openssl/backend.py2
-rw-r--r--cryptography/hazmat/primitives/asymmetric/dsa.py2
-rw-r--r--docs/hazmat/backends/interfaces.rst16
4 files changed, 22 insertions, 6 deletions
diff --git a/cryptography/hazmat/backends/interfaces.py b/cryptography/hazmat/backends/interfaces.py
index 70168a01..5ed49966 100644
--- a/cryptography/hazmat/backends/interfaces.py
+++ b/cryptography/hazmat/backends/interfaces.py
@@ -166,14 +166,14 @@ class DSABackend(object):
@abc.abstractmethod
def generate_dsa_private_key(self, parameters):
"""
- Generate an DSAPrivateKey instance with parameters as
- a DSAParameters object.
+ Generate a DSAPrivateKey instance with parameters as a DSAParameters
+ object.
"""
@abc.abstractmethod
- def generate_dsa_private_key_with_key_size(self, key_size):
+ def generate_dsa_private_key_and_parameters(self, key_size):
"""
- Generate an DSAPrivateKey instance using key size only.
+ Generate a DSAPrivateKey instance using key size only.
"""
@abc.abstractmethod
diff --git a/cryptography/hazmat/backends/openssl/backend.py b/cryptography/hazmat/backends/openssl/backend.py
index 82bdd7cd..8d167ab3 100644
--- a/cryptography/hazmat/backends/openssl/backend.py
+++ b/cryptography/hazmat/backends/openssl/backend.py
@@ -626,7 +626,7 @@ class Backend(object):
return _DSAPrivateKey(self, ctx)
- def generate_dsa_private_key_with_key_size(self, key_size):
+ def generate_dsa_private_key_and_parameters(self, key_size):
parameters = self.generate_dsa_parameters(key_size)
return self.generate_dsa_private_key(parameters)
diff --git a/cryptography/hazmat/primitives/asymmetric/dsa.py b/cryptography/hazmat/primitives/asymmetric/dsa.py
index 08bdad3e..7a8a61c1 100644
--- a/cryptography/hazmat/primitives/asymmetric/dsa.py
+++ b/cryptography/hazmat/primitives/asymmetric/dsa.py
@@ -26,7 +26,7 @@ def generate_parameters(key_size, backend):
def generate_private_key(key_size, backend):
- return backend.generate_dsa_private_key_with_key_size(key_size)
+ return backend.generate_dsa_private_key_and_parameters(key_size)
def _check_dsa_parameters(parameters):
diff --git a/docs/hazmat/backends/interfaces.rst b/docs/hazmat/backends/interfaces.rst
index 5cbd47d1..fea935ce 100644
--- a/docs/hazmat/backends/interfaces.rst
+++ b/docs/hazmat/backends/interfaces.rst
@@ -421,6 +421,22 @@ A specific ``backend`` may provide one or more of these interfaces.
1.0.0 and the key size is larger than 1024; older OpenSSL versions
do not support keys larger than 1024 bits.
+ .. method:: generate_dsa_private_key_and_parameters(key_size)
+
+ :param int key_size: The length of the modulus in bits. It should be
+ either 1024, 2048 or 3072. For keys generated in 2014 this should
+ be at least 2048.
+ Note that some applications (such as SSH) have not yet gained
+ support for larger key sizes specified in FIPS 186-3 and are still
+ restricted to only the 1024-bit keys specified in FIPS 186-2.
+
+ :return: A new instance of a
+ :class:`~cryptography.hazmat.primitives.interfaces.DSAPrivateKey`
+ provider.
+
+ :raises ValueError: This is raised if the key size is not supported
+ by the backend.
+
.. method:: create_dsa_signature_ctx(private_key, algorithm)
:param private_key: An instance of a