EVP: Adapt KEYEXCH, SIGNATURE and ASYM_CIPHER to handle key types better
[openssl.git] / doc / man3 / EVP_PKEY_CTX_new.pod
1 =pod
2
3 =head1 NAME
4
5 EVP_PKEY_CTX_new, EVP_PKEY_CTX_new_id, EVP_PKEY_CTX_new_provided,
6 EVP_PKEY_CTX_dup, EVP_PKEY_CTX_free
7 - public key algorithm context functions
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);
15  EVP_PKEY_CTX *EVP_PKEY_CTX_new_provided(OPENSSL_CTX *libctx,
16                                          const char *name,
17                                          const char *propquery);
18  EVP_PKEY_CTX *EVP_PKEY_CTX_dup(const EVP_PKEY_CTX *ctx);
19  void EVP_PKEY_CTX_free(EVP_PKEY_CTX *ctx);
20
21 =head1 DESCRIPTION
22
23 The EVP_PKEY_CTX_new() function allocates public key algorithm context using
24 the I<pkey> key type and ENGINE I<e>.
25
26 The EVP_PKEY_CTX_new_id() function allocates public key algorithm context
27 using the key type specified by I<id> and ENGINE I<e>.
28
29 The EVP_PKEY_CTX_new_provided() function allocates a public key algorithm
30 context using the library context I<libctx> (see L<OPENSSL_CTX(3)>), the
31 key type specified by I<name> and the property query I<propquery>.  None
32 of the arguments are duplicated, so they  must remain unchanged for the
33 lifetime of the returned B<EVP_PKEY_CTX> or of any of its duplicates.
34
35 EVP_PKEY_CTX_new_id() and EVP_PKEY_CTX_new_provided() are normally
36 used when no B<EVP_PKEY> structure is associated with the operations,
37 for example during parameter generation or key generation for some
38 algorithms.
39
40 EVP_PKEY_CTX_dup() duplicates the context I<ctx>.
41
42 EVP_PKEY_CTX_free() frees up the context I<ctx>.
43 If I<ctx> is NULL, nothing is done.
44
45 =head1 NOTES
46
47 =over 4
48
49 =item 1.
50
51 The B<EVP_PKEY_CTX> structure is an opaque public key algorithm context used
52 by the OpenSSL high level public key API. Contexts B<MUST NOT> be shared between
53 threads: that is it is not permissible to use the same context simultaneously
54 in two threads.
55
56 =item 2.
57
58 We mention "key type" in this manual, which is the same
59 as "algorithm" in most cases, allowing either term to be used
60 interchangeably.  There are algorithms where the I<key type> and the
61 I<algorithm> of the operations that use the keys are not the same,
62 such as EC keys being used for ECDSA and ECDH operations.
63
64 =back
65
66 =head1 RETURN VALUES
67
68 EVP_PKEY_CTX_new(), EVP_PKEY_CTX_new_id(), EVP_PKEY_CTX_dup() returns either
69 the newly allocated B<EVP_PKEY_CTX> structure of B<NULL> if an error occurred.
70
71 EVP_PKEY_CTX_free() does not return a value.
72
73 =head1 SEE ALSO
74
75 L<EVP_PKEY_new(3)>
76
77 =head1 HISTORY
78
79 These functions were added in OpenSSL 1.0.0.
80
81 =head1 COPYRIGHT
82
83 Copyright 2006-2016 The OpenSSL Project Authors. All Rights Reserved.
84
85 Licensed under the Apache License 2.0 (the "License").  You may not use
86 this file except in compliance with the License.  You can obtain a copy
87 in the file LICENSE in the source distribution or at
88 L<https://www.openssl.org/source/license.html>.
89
90 =cut