]> git.ipfire.org Git - thirdparty/openssl.git/blame - doc/man3/EVP_PKEY_CTX_new.pod
DOC: Add more description of EVP_PKEY_fromdata(), and examples
[thirdparty/openssl.git] / doc / man3 / EVP_PKEY_CTX_new.pod
CommitLineData
5165148f
DSH
1=pod
2
3=head1 NAME
4
e683582b
SL
5EVP_PKEY_CTX_new, EVP_PKEY_CTX_new_id, EVP_PKEY_CTX_new_from_name,
6EVP_PKEY_CTX_new_from_pkey, EVP_PKEY_CTX_dup, EVP_PKEY_CTX_free
a07c17ef 7- public key algorithm context functions
5165148f
DSH
8
9=head1 SYNOPSIS
10
11 #include <openssl/evp.h>
12
13 EVP_PKEY_CTX *EVP_PKEY_CTX_new(EVP_PKEY *pkey, ENGINE *e);
14 EVP_PKEY_CTX *EVP_PKEY_CTX_new_id(int id, ENGINE *e);
e683582b
SL
15 EVP_PKEY_CTX *EVP_PKEY_CTX_new_from_name(OPENSSL_CTX *libctx,
16 const char *name,
17 const char *propquery);
18 EVP_PKEY_CTX *EVP_PKEY_CTX_new_from_pkey(OPENSSL_CTX *libctx,
19 EVP_PKEY *pkey);
9fdcc21f 20 EVP_PKEY_CTX *EVP_PKEY_CTX_dup(const EVP_PKEY_CTX *ctx);
5165148f
DSH
21 void EVP_PKEY_CTX_free(EVP_PKEY_CTX *ctx);
22
23=head1 DESCRIPTION
24
25The EVP_PKEY_CTX_new() function allocates public key algorithm context using
f23bc0b7 26the I<pkey> key type and ENGINE I<e>.
5165148f
DSH
27
28The EVP_PKEY_CTX_new_id() function allocates public key algorithm context
f23bc0b7 29using the key type specified by I<id> and ENGINE I<e>.
a07c17ef 30
e683582b 31The EVP_PKEY_CTX_new_from_name() function allocates a public key algorithm
3ee348b0 32context using the library context I<libctx> (see L<OPENSSL_CTX(3)>), the
f23bc0b7 33key type specified by I<name> and the property query I<propquery>. None
3ee348b0
RL
34of the arguments are duplicated, so they must remain unchanged for the
35lifetime of the returned B<EVP_PKEY_CTX> or of any of its duplicates.
a07c17ef 36
e683582b
SL
37The EVP_PKEY_CTX_new_from_pkey() function allocates a public key algorithm
38context using the library context I<libctx> (see L<OPENSSL_CTX(3)>) and the
2ee4a50a
MC
39algorithm specified by I<pkey> and the property query I<propquery>. None of the
40arguments are duplicated, so they must remain unchanged for the lifetime of the
41returned B<EVP_PKEY_CTX> or any of its duplicates.
e683582b
SL
42
43EVP_PKEY_CTX_new_id() and EVP_PKEY_CTX_new_from_name() are normally
a07c17ef
RL
44used when no B<EVP_PKEY> structure is associated with the operations,
45for example during parameter generation or key generation for some
46algorithms.
5165148f 47
028687c0 48EVP_PKEY_CTX_dup() duplicates the context I<ctx>.
5165148f 49
028687c0
RL
50EVP_PKEY_CTX_free() frees up the context I<ctx>.
51If I<ctx> is NULL, nothing is done.
5165148f
DSH
52
53=head1 NOTES
54
f23bc0b7
RL
55=over 4
56
57=item 1.
58
5165148f
DSH
59The B<EVP_PKEY_CTX> structure is an opaque public key algorithm context used
60by the OpenSSL high level public key API. Contexts B<MUST NOT> be shared between
61threads: that is it is not permissible to use the same context simultaneously
62in two threads.
63
f23bc0b7
RL
64=item 2.
65
66We mention "key type" in this manual, which is the same
67as "algorithm" in most cases, allowing either term to be used
68interchangeably. There are algorithms where the I<key type> and the
69I<algorithm> of the operations that use the keys are not the same,
70such as EC keys being used for ECDSA and ECDH operations.
71
72=back
73
5165148f
DSH
74=head1 RETURN VALUES
75
76EVP_PKEY_CTX_new(), EVP_PKEY_CTX_new_id(), EVP_PKEY_CTX_dup() returns either
77the newly allocated B<EVP_PKEY_CTX> structure of B<NULL> if an error occurred.
78
79EVP_PKEY_CTX_free() does not return a value.
80
81=head1 SEE ALSO
82
9b86974e 83L<EVP_PKEY_new(3)>
5165148f
DSH
84
85=head1 HISTORY
86
e683582b
SL
87The EVP_PKEY_CTX_new(), EVP_PKEY_CTX_new_id(), EVP_PKEY_CTX_dup() and
88EVP_PKEY_CTX_free() functions were added in OpenSSL 1.0.0.
89
90The EVP_PKEY_CTX_new_from_name() and EVP_PKEY_CTX_new_from_pkey() functions were
91added in OpenSSL 3.0.
5165148f 92
e2f92610
RS
93=head1 COPYRIGHT
94
95Copyright 2006-2016 The OpenSSL Project Authors. All Rights Reserved.
96
4746f25a 97Licensed under the Apache License 2.0 (the "License"). You may not use
e2f92610
RS
98this file except in compliance with the License. You can obtain a copy
99in the file LICENSE in the source distribution or at
100L<https://www.openssl.org/source/license.html>.
101
102=cut