aboutsummaryrefslogtreecommitdiffstats
path: root/docs/hazmat/primitives/asymmetric/utils.rst
blob: e16c76f138ae36325ffa46d933518b7393b62cde (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
.. 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)``.

    :raises ValueError: Raised if the signature is malformed in any way. This
        **does not** ensure that the signature is *valid*.

.. 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.