Debian Codegraph @

upstream/debian-unstable/man7/provider-skeymgmt.7ssl

raw
1 .\" -*- mode: troff; coding: utf-8 -*-
2 .\" Automatically generated by Pod::Man 5.0102 (Pod::Simple 3.45)
3 .\"
4 .\" Standard preamble:
5 .\" ========================================================================
6 .de Sp \" Vertical space (when we can't use .PP)
7 .if t .sp .5v
8 .if n .sp
9 ..
10 .de Vb \" Begin verbatim text
11 .ft CW
12 .nf
13 .ne \\$1
14 ..
15 .de Ve \" End verbatim text
16 .ft R
17 .fi
18 ..
19 .\" \*(C` and \*(C' are quotes in nroff, nothing in troff, for use with C<>.
20 .ie n \{\
21 . ds C` ""
22 . ds C' ""
23 'br\}
24 .el\{\
25 . ds C`
26 . ds C'
27 'br\}
28 .\"
29 .\" Escape single quotes in literal strings from groff's Unicode transform.
30 .ie \n(.g .ds Aq \(aq
31 .el .ds Aq '
32 .\"
33 .\" If the F register is >0, we'll generate index entries on stderr for
34 .\" titles (.TH), headers (.SH), subsections (.SS), items (.Ip), and index
35 .\" entries marked with X<> in POD. Of course, you'll have to process the
36 .\" output yourself in some meaningful fashion.
37 .\"
38 .\" Avoid warning from groff about undefined register 'F'.
39 .de IX
40 ..
41 .nr rF 0
42 .if \n(.g .if rF .nr rF 1
43 .if (\n(rF:(\n(.g==0)) \{\
44 . if \nF \{\
45 . de IX
46 . tm Index:\\$1\t\\n%\t"\\$2"
47 ..
48 . if !\nF==2 \{\
49 . nr % 0
50 . nr F 2
51 . \}
52 . \}
53 .\}
54 .rr rF
55 .\" ========================================================================
56 .\"
57 .IX Title "PROVIDER-SKEYMGMT 7SSL"
58 .TH PROVIDER-SKEYMGMT 7SSL 2026-04-07 3.6.2 OpenSSL
59 .\" For nroff, turn off justification. Always turn off hyphenation; it makes
60 .\" way too many mistakes in technical documents.
61 .if n .ad l
62 .nh
63 .SH NAME
64 provider\-skeymgmt \- The SKEYMGMT library <\-> provider functions
65 .SH SYNOPSIS
66 .IX Header "SYNOPSIS"
67 .Vb 1
68 \& #include <openssl/core_dispatch.h>
69 \&
70 \& /*
71 \& * None of these are actual functions, but are displayed like this for
72 \& * the function signatures for functions that are offered as function
73 \& * pointers in OSSL_DISPATCH arrays.
74 \& */
75 \&
76 \& /* Key object destruction */
77 \& void OSSL_FUNC_skeymgmt_free(void *keydata);
78 \&
79 \& /* Key object import and export functions */
80 \& void *OSSL_FUNC_skeymgmt_import(void *provctx, int selection,
81 \& const OSSL_PARAM params[]);
82 \& int OSSL_FUNC_skeymgmt_export(void *keydata, int selection,
83 \& OSSL_CALLBACK *param_cb, void *cbarg);
84 \& void *OSSL_FUNC_skeymgmt_generate(void *provctx,
85 \& const OSSL_PARAM params[]);
86 \& const OSSL_PARAM *OSSL_FUNC_skeymgmt_gen_settable_params(void *provctx);
87 \& const OSSL_PARAM *OSSL_FUNC_skeymgmt_imp_settable_params(void *provctx);
88 \& const char *OSSL_FUNC_skeymgmt_get_key_id(void *keydata);
89 .Ve
90 .SH DESCRIPTION
91 .IX Header "DESCRIPTION"
92 The SKEYMGMT operation doesn't have much public visibility in the OpenSSL
93 libraries, rather it is an internal operation that is designed to work
94 with operations that use opaque symmetric keys objects.
95 .PP
96 The SKEYMGMT operation shares knowledge with the operations it works with,
97 therefore the SKEYMGMT and the algorithms which use it must belong to the same
98 provider. The OpenSSL libraries will ensure that they do.
99 .PP
100 The primary responsibility of the SKEYMGMT operation is to hold the
101 provider side key data for the OpenSSL library EVP_SKEY structure.
102 .PP
103 All "functions" mentioned here are passed as function pointers between
104 \&\fIlibcrypto\fR and the provider in \fBOSSL_DISPATCH\fR\|(3) arrays via
105 \&\fBOSSL_ALGORITHM\fR\|(3) arrays that are returned by the provider's
106 \&\fBprovider_query_operation()\fR function
107 (see "Provider Functions" in \fBprovider\-base\fR\|(7)).
108 .PP
109 All these "functions" have a corresponding function type definition
110 named \fBOSSL_FUNC_{name}_fn\fR, and a helper function to retrieve the
111 function pointer from a \fBOSSL_DISPATCH\fR\|(3) element named
112 \&\fBOSSL_FUNC_{name}\fR.
113 .PP
114 \&\fBOSSL_DISPATCH\fR\|(3) arrays are indexed by numbers that are provided as
115 macros in \fBopenssl\-core_dispatch.h\fR\|(7), as follows:
116 .PP
117 .Vb 1
118 \& OSSL_FUNC_skeymgmt_free OSSL_FUNC_SKEYMGMT_FREE
119 \&
120 \& OSSL_FUNC_skeymgmt_import OSSL_FUNC_SKEYMGMT_IMPORT
121 \& OSSL_FUNC_skeymgmt_export OSSL_FUNC_SKEYMGMT_EXPORT
122 \&
123 \& OSSL_FUNC_skeymgmt_generate OSSL_FUNC_SKEYMGMT_GENERATE
124 \&
125 \& OSSL_FUNC_skeymgmt_get_key_id OSSL_FUNC_SKEYMGMT_GET_KEY_ID
126 \& OSSL_FUNC_skeymgmt_imp_settable_params OSSL_FUNC_SKEYMGMT_IMP_SETTABLE_PARAMS
127 \& OSSL_FUNC_skeymgmt_gen_settable_params OSSL_FUNC_SKEYMGMT_GEN_SETTABLE_PARAMS
128 .Ve
129 .PP
130 The SKEYMGMT management is inspired by KEYMGMT but is simpler.
131 .SS "Key Objects"
132 .IX Subsection "Key Objects"
133 A key object is a collection of data for an symmetric key, and is
134 represented as \fIkeydata\fR in this manual.
135 .PP
136 The exact contents of a key object are defined by the provider, and it
137 is assumed that different operations in one and the same provider use
138 the exact same structure to represent this collection of data, so that
139 for example, a key object that has been created using the SKEYMGMT
140 interface can be passed as is to other algorithms from the same provider
141 operations, such as \fBOSSL_FUNC_mac_init_opaque()\fR (see
142 \&\fBprovider\-mac\fR\|(7)).
143 .PP
144 With the export SKEYMGMT function, it's possible to select a specific
145 subset of data to handle, governed by the bits in a \fIselection\fR
146 indicator. The bits are:
147 .IP \fBOSSL_SKEYMGMT_SELECT_SECRET_KEY\fR 4
148 .IX Item "OSSL_SKEYMGMT_SELECT_SECRET_KEY"
149 Indicating that the secret key raw bytes in a key object should be
150 included.
151 .IP \fBOSSL_SKEYMGMT_SELECT_PARAMETERS\fR 4
152 .IX Item "OSSL_SKEYMGMT_SELECT_PARAMETERS"
153 Indicating that the parameters in a key object should be
154 included.
155 .PP
156 Combined selector bits are also defined for easier use:
157 .IP \fBOSSL_SKEYMGMT_SELECT_ALL\fR 4
158 .IX Item "OSSL_SKEYMGMT_SELECT_ALL"
159 Indicating that everything in a key object should be included.
160 .PP
161 The exact interpretation of those bits or how they combine is left to
162 each function where you can specify a selector.
163 .SS "Destructing Function"
164 .IX Subsection "Destructing Function"
165 \&\fBOSSL_FUNC_skeymgmt_free()\fR should free the passed \fIkeydata\fR.
166 .SS "Key Object Import and Export Functions"
167 .IX Subsection "Key Object Import and Export Functions"
168 \&\fBOSSL_FUNC_skeymgmt_import()\fR should import data into \fIkeydata\fR with values
169 taken from the \fBOSSL_PARAM\fR\|(3) array \fIparams\fR. It allocates the \fIkeydata\fR
170 object (there is no separate allocation function).
171 .PP
172 \&\fBOSSL_FUNC_skeymgmt_imp_settable_params()\fR returns a list of parameters that can
173 be provided to the \fBOSSL_FUNC_skeymgmt_import()\fR function.
174 .PP
175 \&\fBOSSL_FUNC_skeymgmt_export()\fR should extract values indicated by \fIselection\fR
176 from \fIkeydata\fR, create an \fBOSSL_PARAM\fR\|(3) array with them and call
177 \&\fIparam_cb\fR with that array as well as the given \fIcbarg\fR.
178 The passed \fBOSSL_PARAM\fR\|(3) array is transient and is freed upon the return from \fIparam_cb\fR.
179 .SS "Key Object Generation Functions"
180 .IX Subsection "Key Object Generation Functions"
181 \&\fBOSSL_FUNC_skeymgmt_generate()\fR creates a new key according to the values
182 taken from the \fBOSSL_PARAM\fR\|(3) array \fIparams\fR. It allocates the \fIkeydata\fR
183 object.
184 .PP
185 \&\fBOSSL_FUNC_skeymgmt_gen_settable_params()\fR returns a list of parameters that can
186 be provided to the \fBOSSL_FUNC_skeymgmt_generate()\fR function.
187 .SS "Key Object Information functions"
188 .IX Subsection "Key Object Information functions"
189 \&\fBOSSL_FUNC_skeymgmt_get_key_id()\fR returns a NUL-terminated string identifying the
190 particular key. The returned string will be freed by a call to \fBEVP_SKEY_free()\fR
191 so callers need to copy it themselves if they want to preserve the value past
192 the key lifetime. The purpose of this function is providing a printable string
193 that can help users to access the specific key. The content of this string is
194 provider-specific.
195 .SS "Common Import and Export Parameters"
196 .IX Subsection "Common Import and Export Parameters"
197 See \fBOSSL_PARAM\fR\|(3) for further details on the parameters structure.
198 .PP
199 Common information parameters currently recognised by built-in
200 skeymgmt algorithms are as follows:
201 .IP """raw-bytes"" (\fBSKEY_PARAM_RAW_BYTES\fR) <octet string>" 4
202 .IX Item """raw-bytes"" (SKEY_PARAM_RAW_BYTES) <octet string>"
203 The value represents symmetric key as a byte array.
204 .IP """key-length"" (\fBSKEY_PARAM_KEY_LENGTH\fR) <integer>" 4
205 .IX Item """key-length"" (SKEY_PARAM_KEY_LENGTH) <integer>"
206 The value is the byte length of the given key.
207 .SH "RETURN VALUES"
208 .IX Header "RETURN VALUES"
209 \&\fBOSSL_FUNC_skeymgmt_import()\fR and \fBOSSL_FUNC_skeymgmt_generate()\fR return a pointer
210 to an allocated object on success and NULL on error.
211 .PP
212 \&\fBOSSL_FUNC_skeymgmt_export()\fR returns 1 for success or 0 on error.
213 .PP
214 \&\fBOSSL_FUNC_skeymgmt_get_key_id()\fR returns a pointer to a 0\-terminated string or NULL.
215 .PP
216 \&\fBOSSL_FUNC_skeymgmt_gen_settable_params()\fR and \fBOSSL_FUNC_skeymgmt_imp_settable_params()\fR
217 return references to an array of \fBOSSL_PARAM\fR which can be NULL if there are
218 no settable parameters.
219 .SH "SEE ALSO"
220 .IX Header "SEE ALSO"
221 \&\fBprovider\fR\|(7), \fBEVP_SKEY\fR\|(3), \fBEVP_KEYMGMT\fR\|(3)
222 .SH HISTORY
223 .IX Header "HISTORY"
224 The SKEYMGMT interface was introduced in OpenSSL 3.5.
225 .SH COPYRIGHT
226 .IX Header "COPYRIGHT"
227 Copyright 2024\-2025 The OpenSSL Project Authors. All Rights Reserved.
228 .PP
229 Licensed under the Apache License 2.0 (the "License"). You may not use
230 this file except in compliance with the License. You can obtain a copy
231 in the file LICENSE in the source distribution or at
232 <https://www.openssl.org/source/license.html>.