1EVP_PKEY_CTX_NEW(3ossl) OpenSSL EVP_PKEY_CTX_NEW(3ossl)
2
3
4
6 EVP_PKEY_CTX_new, EVP_PKEY_CTX_new_id, EVP_PKEY_CTX_new_from_name,
7 EVP_PKEY_CTX_new_from_pkey, EVP_PKEY_CTX_dup, EVP_PKEY_CTX_free,
8 EVP_PKEY_CTX_is_a - public key algorithm context functions
9
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_from_name(OSSL_LIB_CTX *libctx,
16 const char *name,
17 const char *propquery);
18 EVP_PKEY_CTX *EVP_PKEY_CTX_new_from_pkey(OSSL_LIB_CTX *libctx,
19 EVP_PKEY *pkey,
20 const char *propquery);
21 EVP_PKEY_CTX *EVP_PKEY_CTX_dup(const EVP_PKEY_CTX *ctx);
22 void EVP_PKEY_CTX_free(EVP_PKEY_CTX *ctx);
23 int EVP_PKEY_CTX_is_a(EVP_PKEY_CTX *ctx, const char *keytype);
24
26 The EVP_PKEY_CTX_new() function allocates public key algorithm context
27 using the pkey key type and ENGINE e.
28
29 The EVP_PKEY_CTX_new_id() function allocates public key algorithm
30 context using the key type specified by id and ENGINE e.
31
32 The EVP_PKEY_CTX_new_from_name() function allocates a public key
33 algorithm context using the library context libctx (see
34 OSSL_LIB_CTX(3)), the key type specified by name and the property query
35 propquery. None of the arguments are duplicated, so they must remain
36 unchanged for the lifetime of the returned EVP_PKEY_CTX or of any of
37 its duplicates. Read further about the possible names in "NOTES"
38 below.
39
40 The EVP_PKEY_CTX_new_from_pkey() function allocates a public key
41 algorithm context using the library context libctx (see
42 OSSL_LIB_CTX(3)) and the algorithm specified by pkey and the property
43 query propquery. None of the arguments are duplicated, so they must
44 remain unchanged for the lifetime of the returned EVP_PKEY_CTX or any
45 of its duplicates.
46
47 EVP_PKEY_CTX_new_id() and EVP_PKEY_CTX_new_from_name() are normally
48 used when no EVP_PKEY structure is associated with the operations, for
49 example during parameter generation or key generation for some
50 algorithms.
51
52 EVP_PKEY_CTX_dup() duplicates the context ctx. It is not supported for
53 a keygen operation.
54
55 EVP_PKEY_CTX_free() frees up the context ctx. If ctx is NULL, nothing
56 is done.
57
58 EVP_PKEY_is_a() checks if the key type associated with ctx is keytype.
59
61 On EVP_PKEY_CTX
62 The EVP_PKEY_CTX structure is an opaque public key algorithm context
63 used by the OpenSSL high-level public key API. Contexts MUST NOT be
64 shared between threads: that is it is not permissible to use the same
65 context simultaneously in two threads.
66
67 On Key Types
68 We mention "key type" in this manual, which is the same as "algorithm"
69 in most cases, allowing either term to be used interchangeably. There
70 are algorithms where the key type and the algorithm of the operations
71 that use the keys are not the same, such as EC keys being used for
72 ECDSA and ECDH operations.
73
74 Key types are given in two different manners:
75
76 Legacy NID or EVP_PKEY type
77 This is the id used with EVP_PKEY_CTX_new_id().
78
79 These are EVP_PKEY_RSA, EVP_PKEY_RSA_PSS, EVP_PKEY_DSA,
80 EVP_PKEY_DH, EVP_PKEY_EC, EVP_PKEY_SM2, EVP_PKEY_X25519,
81 EVP_PKEY_X448, and are used by legacy methods.
82
83 Name strings
84 This is the name used with EVP_PKEY_CTX_new_from_name().
85
86 These are names like "RSA", "DSA", and what's available depends on
87 what providers are currently accessible.
88
89 The OpenSSL providers offer a set of key types available this way,
90 please see OSSL_PROVIDER-FIPS(7) and OSSL_PROVIDER-default(7) and
91 related documentation for more information.
92
94 EVP_PKEY_CTX_new(), EVP_PKEY_CTX_new_id() and EVP_PKEY_CTX_dup() return
95 either the newly allocated EVP_PKEY_CTX structure or NULL if an error
96 occurred.
97
98 EVP_PKEY_CTX_free() does not return a value.
99
100 EVP_PKEY_CTX_is_a() returns 1 for true and 0 for false.
101
103 EVP_PKEY_new(3)
104
106 The EVP_PKEY_CTX_new(), EVP_PKEY_CTX_new_id(), EVP_PKEY_CTX_dup() and
107 EVP_PKEY_CTX_free() functions were added in OpenSSL 1.0.0.
108
109 The EVP_PKEY_CTX_new_from_name() and EVP_PKEY_CTX_new_from_pkey()
110 functions were added in OpenSSL 3.0.
111
113 Copyright 2006-2021 The OpenSSL Project Authors. All Rights Reserved.
114
115 Licensed under the Apache License 2.0 (the "License"). You may not use
116 this file except in compliance with the License. You can obtain a copy
117 in the file LICENSE in the source distribution or at
118 <https://www.openssl.org/source/license.html>.
119
120
121
1223.1.1 2023-08-31 EVP_PKEY_CTX_NEW(3ossl)