xref: /openssl/doc/man7/EVP_PKEY-X25519.pod (revision 7ed6de99)
1=pod
2
3=head1 NAME
4
5EVP_PKEY-X25519, EVP_PKEY-X448, EVP_PKEY-ED25519, EVP_PKEY-ED448,
6EVP_KEYMGMT-X25519, EVP_KEYMGMT-X448, EVP_KEYMGMT-ED25519, EVP_KEYMGMT-ED448
7- EVP_PKEY X25519, X448, ED25519 and ED448 keytype and algorithm support
8
9=head1 DESCRIPTION
10
11The B<X25519>, B<X448>, B<ED25519> and B<ED448> keytypes are
12implemented in OpenSSL's default and FIPS providers.  These implementations
13support the associated key, containing the public key I<pub> and the
14private key I<priv>.
15
16=head2 Keygen Parameters
17
18=over 4
19
20=item "dhkem-ikm" (B<OSSL_PKEY_PARAM_DHKEM_IKM>) <octet string>
21
22DHKEM requires the generation of a keypair using an input key material (seed).
23Use this to specify the key material used for generation of the private key.
24This value should not be reused for other purposes.
25It should have a length of at least 32 for X25519, and 56 for X448.
26This is only supported by X25519 and X448.
27
28=item "fips-indicator" (B<OSSL_PKEY_PARAM_FIPS_APPROVED_INDICATOR>) <integer>
29
30This getter is only supported by X25519 and X448 for the FIPS provider.
31Since X25519 and X448 are unapproved in FIPS 140-3 this getter return 0.
32
33See L<provider-keymgmt(7)/Common Information Parameters> for further information.
34
35=back
36
37Use EVP_PKEY_CTX_set_params() after calling EVP_PKEY_keygen_init().
38
39=head2 Common X25519, X448, ED25519 and ED448 parameters
40
41In addition to the common parameters that all keytypes should support (see
42L<provider-keymgmt(7)/Common parameters>), the implementation of these keytypes
43support the following.
44
45=over 4
46
47=item "group" (B<OSSL_PKEY_PARAM_GROUP_NAME>) <UTF8 string>
48
49This is only supported by X25519 and X448. The group name must be "x25519" or
50"x448" respectively for those algorithms. This is only present for consistency
51with other key exchange algorithms and is typically not needed.
52
53=item "pub" (B<OSSL_PKEY_PARAM_PUB_KEY>) <octet string>
54
55The public key value.
56
57=item "priv" (B<OSSL_PKEY_PARAM_PRIV_KEY>) <octet string>
58
59The private key value.
60
61=item "encoded-pub-key" (B<OSSL_PKEY_PARAM_ENCODED_PUBLIC_KEY>) <octet string>
62
63Used for getting and setting the encoding of a public key for the B<X25519> and
64B<X448> key types. Public keys are expected be encoded in a format as defined by
65RFC7748.
66
67=back
68
69=head2 ED25519 and ED448 parameters
70
71=over 4
72
73=item "mandatory-digest" (B<OSSL_PKEY_PARAM_MANDATORY_DIGEST>) <UTF8 string>
74
75The empty string, signifying that no digest may be specified.
76
77=back
78
79=head1 CONFORMING TO
80
81=over 4
82
83=item RFC 8032
84
85=item RFC 8410
86
87=back
88
89=head1 EXAMPLES
90
91An B<EVP_PKEY> context can be obtained by calling:
92
93    EVP_PKEY_CTX *pctx =
94        EVP_PKEY_CTX_new_from_name(NULL, "X25519", NULL);
95
96    EVP_PKEY_CTX *pctx =
97        EVP_PKEY_CTX_new_from_name(NULL, "X448", NULL);
98
99    EVP_PKEY_CTX *pctx =
100        EVP_PKEY_CTX_new_from_name(NULL, "ED25519", NULL);
101
102    EVP_PKEY_CTX *pctx =
103        EVP_PKEY_CTX_new_from_name(NULL, "ED448", NULL);
104
105An B<X25519> key can be generated like this:
106
107    pkey = EVP_PKEY_Q_keygen(NULL, NULL, "X25519");
108
109An B<X448>, B<ED25519>, or B<ED448> key can be generated likewise.
110
111=head1 SEE ALSO
112
113L<EVP_KEYMGMT(3)>, L<EVP_PKEY(3)>, L<provider-keymgmt(7)>,
114L<EVP_KEYEXCH-X25519(7)>, L<EVP_KEYEXCH-X448(7)>,
115L<EVP_SIGNATURE-ED25519(7)>, L<EVP_SIGNATURE-ED448(7)>
116
117=head1 COPYRIGHT
118
119Copyright 2020-2024 The OpenSSL Project Authors. All Rights Reserved.
120
121Licensed under the Apache License 2.0 (the "License").  You may not use
122this file except in compliance with the License.  You can obtain a copy
123in the file LICENSE in the source distribution or at
124L<https://www.openssl.org/source/license.html>.
125
126=cut
127