1.. hazmat:: 2 3Ed448 signing 4============= 5 6.. currentmodule:: cryptography.hazmat.primitives.asymmetric.ed448 7 8 9Ed448 is an elliptic curve signing algorithm using `EdDSA`_. 10 11 12Signing & Verification 13~~~~~~~~~~~~~~~~~~~~~~ 14 15.. doctest:: 16 17 >>> from cryptography.hazmat.primitives.asymmetric.ed448 import Ed448PrivateKey 18 >>> private_key = Ed448PrivateKey.generate() 19 >>> signature = private_key.sign(b"my authenticated message") 20 >>> public_key = private_key.public_key() 21 >>> # Raises InvalidSignature if verification fails 22 >>> public_key.verify(signature, b"my authenticated message") 23 24Key interfaces 25~~~~~~~~~~~~~~ 26 27.. class:: Ed448PrivateKey 28 29 .. versionadded:: 2.6 30 31 .. classmethod:: generate() 32 33 Generate an Ed448 private key. 34 35 :returns: :class:`Ed448PrivateKey` 36 37 .. classmethod:: from_private_bytes(data) 38 39 :param data: 57 byte private key. 40 :type data: :term:`bytes-like` 41 42 :returns: :class:`Ed448PrivateKey` 43 44 .. method:: public_key() 45 46 :returns: :class:`Ed448PublicKey` 47 48 .. method:: sign(data) 49 50 :param bytes data: The data to sign. 51 52 :returns bytes: The 114 byte signature. 53 54 .. method:: private_bytes(encoding, format, encryption_algorithm) 55 56 Allows serialization of the key to bytes. Encoding ( 57 :attr:`~cryptography.hazmat.primitives.serialization.Encoding.PEM`, 58 :attr:`~cryptography.hazmat.primitives.serialization.Encoding.DER`, or 59 :attr:`~cryptography.hazmat.primitives.serialization.Encoding.Raw`) and 60 format ( 61 :attr:`~cryptography.hazmat.primitives.serialization.PrivateFormat.PKCS8` 62 or 63 :attr:`~cryptography.hazmat.primitives.serialization.PrivateFormat.Raw` 64 ) are chosen to define the exact serialization. 65 66 :param encoding: A value from the 67 :class:`~cryptography.hazmat.primitives.serialization.Encoding` enum. 68 69 :param format: A value from the 70 :class:`~cryptography.hazmat.primitives.serialization.PrivateFormat` 71 enum. If the ``encoding`` is 72 :attr:`~cryptography.hazmat.primitives.serialization.Encoding.Raw` 73 then ``format`` must be 74 :attr:`~cryptography.hazmat.primitives.serialization.PrivateFormat.Raw` 75 , otherwise it must be 76 :attr:`~cryptography.hazmat.primitives.serialization.PrivateFormat.PKCS8`. 77 78 :param encryption_algorithm: An instance of an object conforming to the 79 :class:`~cryptography.hazmat.primitives.serialization.KeySerializationEncryption` 80 interface. 81 82 :return bytes: Serialized key. 83 84.. class:: Ed448PublicKey 85 86 .. versionadded:: 2.6 87 88 .. classmethod:: from_public_bytes(data) 89 90 :param bytes data: 57 byte public key. 91 92 :returns: :class:`Ed448PublicKey` 93 94 .. method:: public_bytes(encoding, format) 95 96 Allows serialization of the key to bytes. Encoding ( 97 :attr:`~cryptography.hazmat.primitives.serialization.Encoding.PEM`, 98 :attr:`~cryptography.hazmat.primitives.serialization.Encoding.DER`, or 99 :attr:`~cryptography.hazmat.primitives.serialization.Encoding.Raw`) and 100 format ( 101 :attr:`~cryptography.hazmat.primitives.serialization.PublicFormat.SubjectPublicKeyInfo` 102 or 103 :attr:`~cryptography.hazmat.primitives.serialization.PublicFormat.Raw` 104 ) are chosen to define the exact serialization. 105 106 :param encoding: A value from the 107 :class:`~cryptography.hazmat.primitives.serialization.Encoding` enum. 108 109 :param format: A value from the 110 :class:`~cryptography.hazmat.primitives.serialization.PublicFormat` 111 enum. If the ``encoding`` is 112 :attr:`~cryptography.hazmat.primitives.serialization.Encoding.Raw` 113 then ``format`` must be 114 :attr:`~cryptography.hazmat.primitives.serialization.PublicFormat.Raw` 115 , otherwise it must be 116 :attr:`~cryptography.hazmat.primitives.serialization.PublicFormat.SubjectPublicKeyInfo`. 117 118 :returns bytes: The public key bytes. 119 120 .. method:: verify(signature, data) 121 122 :param bytes signature: The signature to verify. 123 124 :param bytes data: The data to verify. 125 126 :raises cryptography.exceptions.InvalidSignature: Raised when the 127 signature cannot be verified. 128 129 130 131.. _`EdDSA`: https://en.wikipedia.org/wiki/EdDSA 132