diff options
Diffstat (limited to 'docs/hazmat/primitives')
-rw-r--r-- | docs/hazmat/primitives/asymmetric/dsa.rst | 9 | ||||
-rw-r--r-- | docs/hazmat/primitives/asymmetric/ec.rst | 3 | ||||
-rw-r--r-- | docs/hazmat/primitives/interfaces.rst | 12 |
3 files changed, 20 insertions, 4 deletions
diff --git a/docs/hazmat/primitives/asymmetric/dsa.rst b/docs/hazmat/primitives/asymmetric/dsa.rst index 302eea81..43741ede 100644 --- a/docs/hazmat/primitives/asymmetric/dsa.rst +++ b/docs/hazmat/primitives/asymmetric/dsa.rst @@ -79,6 +79,9 @@ provider. >>> signer.update(data) >>> signature = signer.finalize() +The ``signature`` is a ``bytes`` object, whose contents is DER encoded as +described in :rfc:`6979`. + Verification ~~~~~~~~~~~~ @@ -92,6 +95,12 @@ provider. >>> verifier.update(data) >>> verifier.verify() +``verifier()`` takes the signature in the same format as is returned by +``signer.finalize()``. + +``verify()`` will raise an :class:`~cryptography.exceptions.InvalidSignature` +exception if the signature isn't valid. + Numbers ~~~~~~~ diff --git a/docs/hazmat/primitives/asymmetric/ec.rst b/docs/hazmat/primitives/asymmetric/ec.rst index 0e19bb2e..a229fe41 100644 --- a/docs/hazmat/primitives/asymmetric/ec.rst +++ b/docs/hazmat/primitives/asymmetric/ec.rst @@ -52,6 +52,9 @@ Elliptic Curve Signature Algorithms >>> signer.update(b" to sign") >>> signature = signer.finalize() + The ``signature`` is a ``bytes`` object, whose contents is DER encoded as + described in :rfc:`6979`. + .. class:: EllipticCurvePrivateNumbers(private_value, public_numbers) diff --git a/docs/hazmat/primitives/interfaces.rst b/docs/hazmat/primitives/interfaces.rst index 4cb64c83..4f185af3 100644 --- a/docs/hazmat/primitives/interfaces.rst +++ b/docs/hazmat/primitives/interfaces.rst @@ -334,6 +334,8 @@ DSA .. 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` @@ -470,8 +472,11 @@ Elliptic Curve An elliptic curve private key for use with an algorithm such as `ECDSA`_ or `EdDSA`_. - .. classmethod:: signer(signature_algorithm) + .. method:: signer(signature_algorithm) + 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 signature_algorithm: An instance of a :class:`~cryptography.hazmat.primitives.interfaces.EllipticCurveSignatureAlgorithm` @@ -483,8 +488,6 @@ Elliptic Curve :type: :class:`~cryptography.hazmat.primitives.interfaces.EllipticCurve` - The elliptic curve for this key. - .. method:: public_key() :return: :class:`~cryptography.hazmat.primitives.interfaces.EllipticCurvePublicKey` @@ -519,7 +522,8 @@ Elliptic Curve Verify data was signed by the private key associated with this public key. - :param bytes signature: The signature to verify. + :param bytes signature: The signature to verify. DER encoded as + specified in :rfc:`6979`. :param signature_algorithm: An instance of a :class:`~cryptography.hazmat.primitives.interfaces.EllipticCurveSignatureAlgorithm` |