Danger

This is a “Hazardous Materials” module. You should ONLY use it if you’re 100% absolutely sure that you know what you’re doing because this module is full of land mines, dragons, and dinosaurs with laser guns.

Asymmetric Utilities

cryptography.hazmat.primitives.asymmetric.utils.decode_dss_signature(signature)

Takes in signatures generated by the DSA/ECDSA signers and returns a tuple (r, s). These signatures are ASN.1 encoded Dss-Sig-Value sequences (as defined in RFC 3279)

Parameters:signature (bytes) – The signature to decode.
Returns:The decoded tuple (r, s).
Raises ValueError:
 Raised if the signature is malformed.
cryptography.hazmat.primitives.asymmetric.utils.encode_dss_signature(r, s)

Creates an ASN.1 encoded Dss-Sig-Value (as defined in RFC 3279) from raw r and s values.

Parameters:
  • r (int) – The raw signature value r.
  • s (int) – The raw signature value s.
Return bytes:

The encoded signature.