1EVP_SIGNATURE-ED25519(7ossl) OpenSSL EVP_SIGNATURE-ED25519(7ossl)
2
3
4
6 EVP_SIGNATURE-ED25519, EVP_SIGNATURE-ED448, Ed25519, Ed448 - EVP_PKEY
7 Ed25519 and Ed448 support
8
10 The Ed25519 and Ed448 EVP_PKEY implementation supports key generation,
11 one-shot digest sign and digest verify using PureEdDSA and Ed25519 or
12 Ed448 (see RFC8032). It has associated private and public key formats
13 compatible with RFC 8410.
14
15 ED25519 and ED448 Signature Parameters
16 No additional parameters can be set during one-shot signing or
17 verification. In particular, because PureEdDSA is used, a digest must
18 NOT be specified when signing or verifying. See EVP_PKEY-X25519(7) for
19 information related to X25519 and X448 keys.
20
21 The following signature parameters can be retrieved using
22 EVP_PKEY_CTX_get_params().
23
24 "algorithm-id" (OSSL_SIGNATURE_PARAM_ALGORITHM_ID) <octet string>
25 The parameters are described in provider-signature(7).
26
28 The PureEdDSA algorithm does not support the streaming mechanism of
29 other signature algorithms using, for example, EVP_DigestUpdate(). The
30 message to sign or verify must be passed using the one-shot
31 EVP_DigestSign() and EVP_DigestVerify() functions.
32
33 When calling EVP_DigestSignInit() or EVP_DigestVerifyInit(), the digest
34 type parameter MUST be set to NULL.
35
36 Applications wishing to sign certificates (or other structures such as
37 CRLs or certificate requests) using Ed25519 or Ed448 can either use
38 X509_sign() or X509_sign_ctx() in the usual way.
39
40 Ed25519 or Ed448 private keys can be set directly using
41 EVP_PKEY_new_raw_private_key(3) or loaded from a PKCS#8 private key
42 file using PEM_read_bio_PrivateKey(3) (or similar function). Completely
43 new keys can also be generated (see the example below). Setting a
44 private key also sets the associated public key.
45
46 Ed25519 or Ed448 public keys can be set directly using
47 EVP_PKEY_new_raw_public_key(3) or loaded from a SubjectPublicKeyInfo
48 structure in a PEM file using PEM_read_bio_PUBKEY(3) (or similar
49 function).
50
51 Ed25519 and Ed448 can be tested with the openssl-speed(1) application
52 since version 1.1.1. Valid algorithm names are ed25519, ed448 and
53 eddsa. If eddsa is specified, then both Ed25519 and Ed448 are
54 benchmarked.
55
57 To sign a message using a ED25519 or ED448 key:
58
59 void do_sign(EVP_PKEY *ed_key, unsigned char *msg, size_t msg_len)
60 {
61 size_t sig_len;
62 unsigned char *sig = NULL;
63 EVP_MD_CTX *md_ctx = EVP_MD_CTX_new();
64
65 EVP_DigestSignInit(md_ctx, NULL, NULL, NULL, ed_key);
66 /* Calculate the requires size for the signature by passing a NULL buffer */
67 EVP_DigestSign(md_ctx, NULL, &sig_len, msg, msg_len);
68 sig = OPENSSL_zalloc(sig_len);
69
70 EVP_DigestSign(md_ctx, sig, &sig_len, msg, msg_len);
71 ...
72 OPENSSL_free(sig);
73 EVP_MD_CTX_free(md_ctx);
74 }
75
77 EVP_PKEY-X25519(7) provider-signature(7), EVP_DigestSignInit(3),
78 EVP_DigestVerifyInit(3),
79
81 Copyright 2017-2021 The OpenSSL Project Authors. All Rights Reserved.
82
83 Licensed under the Apache License 2.0 (the "License"). You may not use
84 this file except in compliance with the License. You can obtain a copy
85 in the file LICENSE in the source distribution or at
86 <https://www.openssl.org/source/license.html>.
87
88
89
903.0.5 2022-11-01 EVP_SIGNATURE-ED25519(7ossl)