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.
Interfaces¶
cryptography uses Abstract Base Classes as interfaces to describe the properties and methods of most primitive constructs. Backends may also use this information to influence their operation. Interfaces should also be used to document argument and return types.
Asymmetric interfaces¶
In 0.8 the asymmetric signature and verification interfaces were moved to the cryptography.hazmat.primitives.asymmetric module.
In 0.8 the asymmetric padding interface was moved to the cryptography.hazmat.primitives.asymmetric.padding module.
DSA¶
In 0.8 the DSA key interfaces were moved to the cryptography.hazmat.primitives.asymmetric.dsa module.
RSA¶
In 0.8 the RSA key interfaces were moved to the cryptography.hazmat.primitives.asymmetric.rsa module.
Elliptic Curve¶
In 0.8 the EC key interfaces were moved to the cryptography.hazmat.primitives.asymmetric.ec module.
Key derivation functions¶
In 0.8 the key derivation function interface was moved to the cryptography.hazmat.primitives.kdf module.
- class cryptography.hazmat.primitives.interfaces.MACContext¶
New in version 0.7.
- update(data)¶
Parameters: data (bytes) – The data you want to authenticate.
- finalize()¶
Returns: The message authentication code.
- copy()¶
Returns: A MACContext that is a copy of the current context.
- verify(signature)¶
Parameters: signature (bytes) – The signature to verify. Raises cryptography.exceptions.InvalidSignature: This is raised when the provided signature does not match the expected signature.