1X25519(7ossl)                       OpenSSL                      X25519(7ossl)
2
3
4

NAME

6       X25519, X448 - EVP_PKEY X25519 and X448 support
7

DESCRIPTION

9       The X25519 and X448 EVP_PKEY implementation supports key generation and
10       key derivation using X25519 and X448. It has associated private and
11       public key formats compatible with RFC 8410.
12
13       No additional parameters can be set during key generation.
14
15       The peer public key must be set using EVP_PKEY_derive_set_peer() when
16       performing key derivation.
17

NOTES

19       A context for the X25519 algorithm can be obtained by calling:
20
21        EVP_PKEY_CTX *pctx = EVP_PKEY_CTX_new_id(EVP_PKEY_X25519, NULL);
22
23       For the X448 algorithm a context can be obtained by calling:
24
25        EVP_PKEY_CTX *pctx = EVP_PKEY_CTX_new_id(EVP_PKEY_X448, NULL);
26
27       X25519 or X448 private keys can be set directly using
28       EVP_PKEY_new_raw_private_key(3) or loaded from a PKCS#8 private key
29       file using PEM_read_bio_PrivateKey(3) (or similar function). Completely
30       new keys can also be generated (see the example below). Setting a
31       private key also sets the associated public key.
32
33       X25519 or X448 public keys can be set directly using
34       EVP_PKEY_new_raw_public_key(3) or loaded from a SubjectPublicKeyInfo
35       structure in a PEM file using PEM_read_bio_PUBKEY(3) (or similar
36       function).
37

EXAMPLES

39       This example generates an X25519 private key and writes it to standard
40       output in PEM format:
41
42        #include <openssl/evp.h>
43        #include <openssl/pem.h>
44        ...
45        EVP_PKEY *pkey = NULL;
46        EVP_PKEY_CTX *pctx = EVP_PKEY_CTX_new_id(EVP_PKEY_X25519, NULL);
47        EVP_PKEY_keygen_init(pctx);
48        EVP_PKEY_keygen(pctx, &pkey);
49        EVP_PKEY_CTX_free(pctx);
50        PEM_write_PrivateKey(stdout, pkey, NULL, NULL, 0, NULL, NULL);
51
52       The key derivation example in EVP_PKEY_derive(3) can be used with
53       X25519 and X448.
54

SEE ALSO

56       EVP_PKEY_CTX_new(3), EVP_PKEY_keygen(3), EVP_PKEY_derive(3),
57       EVP_PKEY_derive_set_peer(3)
58
60       Copyright 2017-2020 The OpenSSL Project Authors. All Rights Reserved.
61
62       Licensed under the Apache License 2.0 (the "License").  You may not use
63       this file except in compliance with the License.  You can obtain a copy
64       in the file LICENSE in the source distribution or at
65       <https://www.openssl.org/source/license.html>.
66
67
68
693.0.5                             2022-11-01                     X25519(7ossl)
Impressum