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.
Ed448 signing¶
Ed448 is an elliptic curve signing algorithm using EdDSA.
Signing & Verification¶
>>> from cryptography.hazmat.primitives.asymmetric.ed448 import Ed448PrivateKey
>>> private_key = Ed448PrivateKey.generate()
>>> signature = private_key.sign(b"my authenticated message")
>>> public_key = private_key.public_key()
>>> # Raises InvalidSignature if verification fails
>>> public_key.verify(signature, b"my authenticated message")
Key interfaces¶
- class cryptography.hazmat.primitives.asymmetric.ed448.Ed448PrivateKey[source]¶
New in version 2.6.
- classmethod from_private_bytes(data)[source]¶
- Parameters:
data (bytes-like) – 57 byte private key.
- Returns:
- sign(data)[source]¶
- Parameters:
data (bytes) – The data to sign.
- Returns bytes:
The 114 byte signature.
- private_bytes(encoding, format, encryption_algorithm)[source]¶
Allows serialization of the key to bytes. Encoding (
PEM
,DER
, orRaw
) and format (PKCS8
orRaw
) are chosen to define the exact serialization.- Parameters:
encoding – A value from the
Encoding
enum.format – A value from the
PrivateFormat
enum. If theencoding
isRaw
thenformat
must beRaw
, otherwise it must bePKCS8
.encryption_algorithm – An instance of an object conforming to the
KeySerializationEncryption
interface.
- Return bytes:
Serialized key.
- class cryptography.hazmat.primitives.asymmetric.ed448.Ed448PublicKey[source]¶
New in version 2.6.
- classmethod from_public_bytes(data)[source]¶
- Parameters:
data (bytes) – 57 byte public key.
- Returns:
- public_bytes(encoding, format)[source]¶
Allows serialization of the key to bytes. Encoding (
PEM
,DER
, orRaw
) and format (SubjectPublicKeyInfo
orRaw
) are chosen to define the exact serialization.- Parameters:
encoding – A value from the
Encoding
enum.format – A value from the
PublicFormat
enum. If theencoding
isRaw
thenformat
must beRaw
, otherwise it must beSubjectPublicKeyInfo
.
- Returns bytes:
The public key bytes.
- verify(signature, data)[source]¶
- Parameters:
- Raises:
cryptography.exceptions.InvalidSignature – Raised when the signature cannot be verified.