Skip to content

Commit

Permalink
Merge pull request #1634 from public/deprecate-dsa
Browse files Browse the repository at this point in the history
Move DSA* interfaces to interfaces.dsa module
  • Loading branch information
reaperhulk committed Jan 23, 2015
2 parents 418053a + d76aa47 commit b9690ab
Show file tree
Hide file tree
Showing 10 changed files with 352 additions and 294 deletions.
8 changes: 8 additions & 0 deletions CHANGELOG.rst
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,14 @@ Changelog
now load elliptic curve public keys.
* Added
:func:`~cryptography.hazmat.primitives.asymmetric.rsa.rsa_recover_prime_factors`
* :class:`~cryptography.hazmat.primitives.asymmetric.dsa.DSAParameters`,
:class:`~cryptography.hazmat.primitives.asymmetric.dsa.DSAParametersWithNumbers`,
:class:`~cryptography.hazmat.primitives.asymmetric.dsa.DSAPrivateKey`,
:class:`~cryptography.hazmat.primitives.asymmetric.dsa.DSAPrivateKeyWithNumbers`,
:class:`~cryptography.hazmat.primitives.asymmetric.dsa.DSAPublicKey` and
:class:`~cryptography.hazmat.primitives.asymmetric.dsa.DSAPublicKeyWithNumbers`
were moved from :mod:`~cryptography.hazmat.primitives.interfaces` to
:mod:`~cryptography.hazmat.primitives.asymmetric.dsa`

0.7.2 - 2015-01-16
~~~~~~~~~~~~~~~~~~
Expand Down
12 changes: 6 additions & 6 deletions docs/hazmat/backends/interfaces.rst
Original file line number Diff line number Diff line change
Expand Up @@ -306,17 +306,17 @@ A specific ``backend`` may provide one or more of these interfaces.
restricted to only the 1024-bit keys specified in FIPS 186-2.

:return: A new instance of a
:class:`~cryptography.hazmat.primitives.interfaces.DSAParameters`
:class:`~cryptography.hazmat.primitives.asymmetric.dsa.DSAParameters`
provider.

.. method:: generate_dsa_private_key(parameters)

:param parameters: A
:class:`~cryptography.hazmat.primitives.interfaces.DSAParameters`
:class:`~cryptography.hazmat.primitives.asymmetric.dsa.DSAParameters`
provider.

:return: A new instance of a
:class:`~cryptography.hazmat.primitives.interfaces.DSAPrivateKey`
:class:`~cryptography.hazmat.primitives.asymmetric.dsa.DSAPrivateKey`
provider.

:raises ValueError: This is raised if the key size is not one of 1024,
Expand Down Expand Up @@ -366,7 +366,7 @@ A specific ``backend`` may provide one or more of these interfaces.
:class:`~cryptography.hazmat.primitives.asymmetric.dsa.DSAParameterNumbers`.

:returns: A provider of
:class:`~cryptography.hazmat.primitives.interfaces.DSAParameters`.
:class:`~cryptography.hazmat.primitives.asymmetric.dsa.DSAParameters`.

:raises cryptography.exceptions.UnsupportedAlgorithm: This is raised
when any backend specific criteria are not met.
Expand All @@ -377,7 +377,7 @@ A specific ``backend`` may provide one or more of these interfaces.
:class:`~cryptography.hazmat.primitives.asymmetric.dsa.DSAPrivateNumbers`.

:returns: A provider of
:class:`~cryptography.hazmat.primitives.interfaces.DSAPrivateKey`.
:class:`~cryptography.hazmat.primitives.asymmetric.dsa.DSAPrivateKey`.

:raises cryptography.exceptions.UnsupportedAlgorithm: This is raised
when any backend specific criteria are not met.
Expand All @@ -388,7 +388,7 @@ A specific ``backend`` may provide one or more of these interfaces.
:class:`~cryptography.hazmat.primitives.asymmetric.dsa.DSAPublicNumbers`.

:returns: A provider of
:class:`~cryptography.hazmat.primitives.interfaces.DSAPublicKey`.
:class:`~cryptography.hazmat.primitives.asymmetric.dsa.DSAPublicKey`.

:raises cryptography.exceptions.UnsupportedAlgorithm: This is raised
when any backend specific criteria are not met.
Expand Down
177 changes: 166 additions & 11 deletions docs/hazmat/primitives/asymmetric/dsa.rst
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ Generation
:class:`~cryptography.hazmat.backends.interfaces.DSABackend`
provider.

:return: A :class:`~cryptography.hazmat.primitives.interfaces.DSAPrivateKey`
:return: A :class:`~cryptography.hazmat.primitives.asymmetric.dsa.DSAPrivateKey`
provider.

:raises cryptography.exceptions.UnsupportedAlgorithm: This is raised if
Expand All @@ -52,7 +52,7 @@ Generation
:class:`~cryptography.hazmat.backends.interfaces.DSABackend`
provider.

:return: A :class:`~cryptography.hazmat.primitives.interfaces.DSAParameters`
:return: A :class:`~cryptography.hazmat.primitives.asymmetric.dsa.DSAParameters`
provider.

:raises cryptography.exceptions.UnsupportedAlgorithm: This is raised if
Expand All @@ -62,7 +62,7 @@ Generation
Signing
~~~~~~~

Using a :class:`~cryptography.hazmat.primitives.interfaces.DSAPrivateKey`
Using a :class:`~cryptography.hazmat.primitives.asymmetric.dsa.DSAPrivateKey`
provider.

.. doctest::
Expand All @@ -86,7 +86,7 @@ described in :rfc:`6979`. This can be decoded using
Verification
~~~~~~~~~~~~

Using a :class:`~cryptography.hazmat.primitives.interfaces.DSAPublicKey`
Using a :class:`~cryptography.hazmat.primitives.asymmetric.dsa.DSAPublicKey`
provider.

.. doctest::
Expand Down Expand Up @@ -136,7 +136,7 @@ Numbers
provider.

:returns: A new instance of a
:class:`~cryptography.hazmat.primitives.interfaces.DSAParameters`
:class:`~cryptography.hazmat.primitives.asymmetric.dsa.DSAParameters`
provider.

.. class:: DSAPublicNumbers(y, parameter_numbers)
Expand All @@ -153,9 +153,9 @@ Numbers

.. attribute:: parameter_numbers

:type: :class:`~cryptography.hazmat.primitives.dsa.DSAParameterNumbers`
:type: :class:`~cryptography.hazmat.primitives.asymmetric.dsa.DSAParameterNumbers`

The :class:`~cryptography.hazmat.primitives.dsa.DSAParameterNumbers`
The :class:`~cryptography.hazmat.primitives.asymmetric.dsa.DSAParameterNumbers`
associated with the public key.

.. method:: public_key(backend)
Expand All @@ -165,7 +165,7 @@ Numbers
provider.

:returns: A new instance of a
:class:`~cryptography.hazmat.primitives.interfaces.DSAPublicKey`
:class:`~cryptography.hazmat.primitives.asymmetric.dsa.DSAPublicKey`
provider.

.. class:: DSAPrivateNumbers(x, public_numbers)
Expand All @@ -187,9 +187,9 @@ Numbers

.. attribute:: public_numbers

:type: :class:`~cryptography.hazmat.primitives.dsa.DSAPublicNumbers`
:type: :class:`~cryptography.hazmat.primitives.asymmetric.dsa.DSAPublicNumbers`

The :class:`~cryptography.hazmat.primitives.dsa.DSAPublicNumbers`
The :class:`~cryptography.hazmat.primitives.asymmetric.dsa.DSAPublicNumbers`
associated with the private key.

.. method:: private_key(backend)
Expand All @@ -199,9 +199,164 @@ Numbers
provider.

:returns: A new instance of a
:class:`~cryptography.hazmat.primitives.interfaces.DSAPrivateKey`
:class:`~cryptography.hazmat.primitives.asymmetric.dsa.DSAPrivateKey`
provider.

Key interfaces
~~~~~~~~~~~~~~

.. class:: DSAParameters

.. versionadded:: 0.3

`DSA`_ parameters.

.. method:: generate_private_key()

.. versionadded:: 0.5

Generate a DSA private key. This method can be used to generate many
new private keys from a single set of parameters.

:return: A
:class:`~cryptography.hazmat.primitives.asymmetric.dsa.DSAPrivateKey`
provider.


.. class:: DSAParametersWithNumbers

.. versionadded:: 0.5

Extends :class:`DSAParameters`.

.. method:: parameter_numbers()

Create a
:class:`~cryptography.hazmat.primitives.asymmetric.dsa.DSAParameterNumbers`
object.

:returns: A
:class:`~cryptography.hazmat.primitives.asymmetric.dsa.DSAParameterNumbers`
instance.


.. class:: DSAPrivateKey

.. versionadded:: 0.3

A `DSA`_ private key.

.. method:: public_key()

:return: :class:`~cryptography.hazmat.primitives.asymmetric.dsa.DSAPublicKey`

An DSA public key object corresponding to the values of the private key.

.. method:: parameters()

:return: :class:`~cryptography.hazmat.primitives.asymmetric.dsa.DSAParameters`

The DSAParameters object associated with this private key.

.. method:: signer(algorithm, backend)

.. versionadded:: 0.4

Sign data which can be verified later by others using the public key.
The signature is formatted as DER-encoded bytes, as specified in
:rfc:`6979`.

:param algorithm: An instance of a
:class:`~cryptography.hazmat.primitives.interfaces.HashAlgorithm`
provider.

:param backend: A
:class:`~cryptography.hazmat.backends.interfaces.DSABackend`
provider.

:returns:
:class:`~cryptography.hazmat.primitives.interfaces.AsymmetricSignatureContext`

.. attribute:: key_size

:type: int

The bit length of the modulus.


.. class:: DSAPrivateKeyWithNumbers

.. versionadded:: 0.5

Extends :class:`DSAPrivateKey`.

.. method:: private_numbers()

Create a
:class:`~cryptography.hazmat.primitives.asymmetric.dsa.DSAPrivateNumbers`
object.

:returns: A
:class:`~cryptography.hazmat.primitives.asymmetric.dsa.DSAPrivateNumbers`
instance.


.. class:: DSAPublicKey

.. versionadded:: 0.3

A `DSA`_ public key.

.. attribute:: key_size

:type: int

The bit length of the modulus.

.. method:: parameters()

:return: :class:`~cryptography.hazmat.primitives.asymmetric.dsa.DSAParameters`

The DSAParameters object associated with this public key.

.. method:: verifier(signature, algorithm, backend)

.. versionadded:: 0.4

Verify data was signed by the private key associated with this public
key.

:param bytes signature: The signature to verify. DER encoded as
specified in :rfc:`6979`.

:param algorithm: An instance of a
:class:`~cryptography.hazmat.primitives.interfaces.HashAlgorithm`
provider.

:param backend: A
:class:`~cryptography.hazmat.backends.interfaces.DSABackend`
provider.

:returns:
:class:`~cryptography.hazmat.primitives.interfaces.AsymmetricVerificationContext`


.. class:: DSAPublicKeyWithNumbers

.. versionadded:: 0.5

Extends :class:`DSAPublicKey`.

.. method:: public_numbers()

Create a
:class:`~cryptography.hazmat.primitives.asymmetric.dsa.DSAPublicNumbers`
object.

:returns: A
:class:`~cryptography.hazmat.primitives.asymmetric.dsa.DSAPublicNumbers`
instance.


.. _`DSA`: https://en.wikipedia.org/wiki/Digital_Signature_Algorithm
.. _`public-key`: https://en.wikipedia.org/wiki/Public-key_cryptography
Expand Down

0 comments on commit b9690ab

Please sign in to comment.