diff options
author | Alex Gaynor <alex.gaynor@gmail.com> | 2014-12-08 11:01:00 -0800 |
---|---|---|
committer | Alex Gaynor <alex.gaynor@gmail.com> | 2014-12-08 11:01:00 -0800 |
commit | 68416c33d3868465f2485e4facae84900ad2c632 (patch) | |
tree | 2c6923033e22467c1e750f98afe237323fcd617e /docs/hazmat/primitives | |
parent | 9e507d2ab62cec4c9b63b08a6f5ae8656106a162 (diff) | |
parent | ac4d5f2249de136cbfef72aa650dcc4703b67851 (diff) | |
download | cryptography-68416c33d3868465f2485e4facae84900ad2c632.tar.gz cryptography-68416c33d3868465f2485e4facae84900ad2c632.tar.bz2 cryptography-68416c33d3868465f2485e4facae84900ad2c632.zip |
Merge pull request #1502 from reaperhulk/fix-1285
Support decoding RFC 6979 signatures to (r, s)
Diffstat (limited to 'docs/hazmat/primitives')
-rw-r--r-- | docs/hazmat/primitives/asymmetric/dsa.rst | 3 | ||||
-rw-r--r-- | docs/hazmat/primitives/asymmetric/ec.rst | 4 | ||||
-rw-r--r-- | docs/hazmat/primitives/asymmetric/index.rst | 1 | ||||
-rw-r--r-- | docs/hazmat/primitives/asymmetric/utils.rst | 26 |
4 files changed, 32 insertions, 2 deletions
diff --git a/docs/hazmat/primitives/asymmetric/dsa.rst b/docs/hazmat/primitives/asymmetric/dsa.rst index 43741ede..df3c99fc 100644 --- a/docs/hazmat/primitives/asymmetric/dsa.rst +++ b/docs/hazmat/primitives/asymmetric/dsa.rst @@ -80,7 +80,8 @@ provider. >>> signature = signer.finalize() The ``signature`` is a ``bytes`` object, whose contents is DER encoded as -described in :rfc:`6979`. +described in :rfc:`6979`. This can be decoded using +:func:`~cryptography.hazmat.primitives.asymmetric.utils.decode_rfc6979_signature`. Verification ~~~~~~~~~~~~ diff --git a/docs/hazmat/primitives/asymmetric/ec.rst b/docs/hazmat/primitives/asymmetric/ec.rst index fd20cbb2..13ab7c11 100644 --- a/docs/hazmat/primitives/asymmetric/ec.rst +++ b/docs/hazmat/primitives/asymmetric/ec.rst @@ -53,7 +53,9 @@ Elliptic Curve Signature Algorithms >>> signature = signer.finalize() The ``signature`` is a ``bytes`` object, whose contents is DER encoded as - described in :rfc:`6979`. + described in :rfc:`6979`. This can be decoded using + :func:`~cryptography.hazmat.primitives.asymmetric.utils.decode_rfc6979_signature`. + .. class:: EllipticCurvePrivateNumbers(private_value, public_numbers) diff --git a/docs/hazmat/primitives/asymmetric/index.rst b/docs/hazmat/primitives/asymmetric/index.rst index 6a5228ba..24f0f5b1 100644 --- a/docs/hazmat/primitives/asymmetric/index.rst +++ b/docs/hazmat/primitives/asymmetric/index.rst @@ -11,3 +11,4 @@ Asymmetric algorithms rsa padding serialization + utils diff --git a/docs/hazmat/primitives/asymmetric/utils.rst b/docs/hazmat/primitives/asymmetric/utils.rst new file mode 100644 index 00000000..6b348801 --- /dev/null +++ b/docs/hazmat/primitives/asymmetric/utils.rst @@ -0,0 +1,26 @@ +.. hazmat:: + +Asymmetric Utilities +==================== + +.. currentmodule:: cryptography.hazmat.primitives.asymmetric.utils + + +.. function:: decode_rfc6979_signature(signature) + + Takes in :rfc:`6979` signatures generated by the DSA/ECDSA signers and + returns a tuple ``(r, s)``. + + :param bytes signature: The signature to decode. + + :returns: The decoded tuple ``(r, s)``. + +.. function:: encode_rfc6979_signature(r, s) + + Creates an :rfc:`6979` byte string from raw signature values. + + :param int r: The raw signature value ``r``. + + :param int s: The raw signature value ``s``. + + :return bytes: The encoded signature. |