Skip to content

Latest commit

 

History

History
131 lines (86 loc) · 4.31 KB

File metadata and controls

131 lines (86 loc) · 4.31 KB

Ed448 signing

cryptography.hazmat.primitives.asymmetric.ed448

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

2.6

generate()

Generate an Ed448 private key.

returns

Ed448PrivateKey

from_private_bytes(data)

param data

57 byte private key.

type data

bytes-like

returns

Ed448PrivateKey

public_key()

returns

Ed448PublicKey

sign(data)

param bytes data

The data to sign.

returns bytes

The 114 byte signature.

private_bytes(encoding, format, encryption_algorithm)

Allows serialization of the key to bytes. Encoding ( ~cryptography.hazmat.primitives.serialization.Encoding.PEM, ~cryptography.hazmat.primitives.serialization.Encoding.DER, or ~cryptography.hazmat.primitives.serialization.Encoding.Raw) and format ( ~cryptography.hazmat.primitives.serialization.PrivateFormat.PKCS8 or ~cryptography.hazmat.primitives.serialization.PrivateFormat.Raw ) are chosen to define the exact serialization.

param encoding

A value from the ~cryptography.hazmat.primitives.serialization.Encoding enum.

param format

A value from the ~cryptography.hazmat.primitives.serialization.PrivateFormat enum. If the encoding is ~cryptography.hazmat.primitives.serialization.Encoding.Raw then format must be ~cryptography.hazmat.primitives.serialization.PrivateFormat.Raw , otherwise it must be ~cryptography.hazmat.primitives.serialization.PrivateFormat.PKCS8.

param encryption_algorithm

An instance of an object conforming to the ~cryptography.hazmat.primitives.serialization.KeySerializationEncryption interface.

return bytes

Serialized key.

2.6

from_public_bytes(data)

param bytes data

57 byte public key.

returns

Ed448PublicKey

public_bytes(encoding, format)

Allows serialization of the key to bytes. Encoding ( ~cryptography.hazmat.primitives.serialization.Encoding.PEM, ~cryptography.hazmat.primitives.serialization.Encoding.DER, or ~cryptography.hazmat.primitives.serialization.Encoding.Raw) and format ( ~cryptography.hazmat.primitives.serialization.PublicFormat.SubjectPublicKeyInfo or ~cryptography.hazmat.primitives.serialization.PublicFormat.Raw ) are chosen to define the exact serialization.

param encoding

A value from the ~cryptography.hazmat.primitives.serialization.Encoding enum.

param format

A value from the ~cryptography.hazmat.primitives.serialization.PublicFormat enum. If the encoding is ~cryptography.hazmat.primitives.serialization.Encoding.Raw then format must be ~cryptography.hazmat.primitives.serialization.PublicFormat.Raw , otherwise it must be ~cryptography.hazmat.primitives.serialization.PublicFormat.SubjectPublicKeyInfo.

returns bytes

The public key bytes.

verify(signature, data)

param bytes signature

The signature to verify.

param bytes data

The data to verify.

raises cryptography.exceptions.InvalidSignature

Raised when the signature cannot be verified.