AP05/openssl/share/man/man7/provider-skeymgmt.7ossl
2025-06-02 18:54:38 +08:00

313 lines
12 KiB
Plaintext

.\" Automatically generated by Pod::Man 2.28 (Pod::Simple 3.29)
.\"
.\" Standard preamble:
.\" ========================================================================
.de Sp \" Vertical space (when we can't use .PP)
.if t .sp .5v
.if n .sp
..
.de Vb \" Begin verbatim text
.ft CW
.nf
.ne \\$1
..
.de Ve \" End verbatim text
.ft R
.fi
..
.\" Set up some character translations and predefined strings. \*(-- will
.\" give an unbreakable dash, \*(PI will give pi, \*(L" will give a left
.\" double quote, and \*(R" will give a right double quote. \*(C+ will
.\" give a nicer C++. Capital omega is used to do unbreakable dashes and
.\" therefore won't be available. \*(C` and \*(C' expand to `' in nroff,
.\" nothing in troff, for use with C<>.
.tr \(*W-
.ds C+ C\v'-.1v'\h'-1p'\s-2+\h'-1p'+\s0\v'.1v'\h'-1p'
.ie n \{\
. ds -- \(*W-
. ds PI pi
. if (\n(.H=4u)&(1m=24u) .ds -- \(*W\h'-12u'\(*W\h'-12u'-\" diablo 10 pitch
. if (\n(.H=4u)&(1m=20u) .ds -- \(*W\h'-12u'\(*W\h'-8u'-\" diablo 12 pitch
. ds L" ""
. ds R" ""
. ds C` ""
. ds C' ""
'br\}
.el\{\
. ds -- \|\(em\|
. ds PI \(*p
. ds L" ``
. ds R" ''
. ds C`
. ds C'
'br\}
.\"
.\" Escape single quotes in literal strings from groff's Unicode transform.
.ie \n(.g .ds Aq \(aq
.el .ds Aq '
.\"
.\" If the F register is turned on, we'll generate index entries on stderr for
.\" titles (.TH), headers (.SH), subsections (.SS), items (.Ip), and index
.\" entries marked with X<> in POD. Of course, you'll have to process the
.\" output yourself in some meaningful fashion.
.\"
.\" Avoid warning from groff about undefined register 'F'.
.de IX
..
.nr rF 0
.if \n(.g .if rF .nr rF 1
.if (\n(rF:(\n(.g==0)) \{
. if \nF \{
. de IX
. tm Index:\\$1\t\\n%\t"\\$2"
..
. if !\nF==2 \{
. nr % 0
. nr F 2
. \}
. \}
.\}
.rr rF
.\"
.\" Accent mark definitions (@(#)ms.acc 1.5 88/02/08 SMI; from UCB 4.2).
.\" Fear. Run. Save yourself. No user-serviceable parts.
. \" fudge factors for nroff and troff
.if n \{\
. ds #H 0
. ds #V .8m
. ds #F .3m
. ds #[ \f1
. ds #] \fP
.\}
.if t \{\
. ds #H ((1u-(\\\\n(.fu%2u))*.13m)
. ds #V .6m
. ds #F 0
. ds #[ \&
. ds #] \&
.\}
. \" simple accents for nroff and troff
.if n \{\
. ds ' \&
. ds ` \&
. ds ^ \&
. ds , \&
. ds ~ ~
. ds /
.\}
.if t \{\
. ds ' \\k:\h'-(\\n(.wu*8/10-\*(#H)'\'\h"|\\n:u"
. ds ` \\k:\h'-(\\n(.wu*8/10-\*(#H)'\`\h'|\\n:u'
. ds ^ \\k:\h'-(\\n(.wu*10/11-\*(#H)'^\h'|\\n:u'
. ds , \\k:\h'-(\\n(.wu*8/10)',\h'|\\n:u'
. ds ~ \\k:\h'-(\\n(.wu-\*(#H-.1m)'~\h'|\\n:u'
. ds / \\k:\h'-(\\n(.wu*8/10-\*(#H)'\z\(sl\h'|\\n:u'
.\}
. \" troff and (daisy-wheel) nroff accents
.ds : \\k:\h'-(\\n(.wu*8/10-\*(#H+.1m+\*(#F)'\v'-\*(#V'\z.\h'.2m+\*(#F'.\h'|\\n:u'\v'\*(#V'
.ds 8 \h'\*(#H'\(*b\h'-\*(#H'
.ds o \\k:\h'-(\\n(.wu+\w'\(de'u-\*(#H)/2u'\v'-.3n'\*(#[\z\(de\v'.3n'\h'|\\n:u'\*(#]
.ds d- \h'\*(#H'\(pd\h'-\w'~'u'\v'-.25m'\f2\(hy\fP\v'.25m'\h'-\*(#H'
.ds D- D\\k:\h'-\w'D'u'\v'-.11m'\z\(hy\v'.11m'\h'|\\n:u'
.ds th \*(#[\v'.3m'\s+1I\s-1\v'-.3m'\h'-(\w'I'u*2/3)'\s-1o\s+1\*(#]
.ds Th \*(#[\s+2I\s-2\h'-\w'I'u*3/5'\v'-.3m'o\v'.3m'\*(#]
.ds ae a\h'-(\w'a'u*4/10)'e
.ds Ae A\h'-(\w'A'u*4/10)'E
. \" corrections for vroff
.if v .ds ~ \\k:\h'-(\\n(.wu*9/10-\*(#H)'\s-2\u~\d\s+2\h'|\\n:u'
.if v .ds ^ \\k:\h'-(\\n(.wu*10/11-\*(#H)'\v'-.4m'^\v'.4m'\h'|\\n:u'
. \" for low resolution devices (crt and lpr)
.if \n(.H>23 .if \n(.V>19 \
\{\
. ds : e
. ds 8 ss
. ds o a
. ds d- d\h'-1'\(ga
. ds D- D\h'-1'\(hy
. ds th \o'bp'
. ds Th \o'LP'
. ds ae ae
. ds Ae AE
.\}
.rm #[ #] #H #V #F C
.\" ========================================================================
.\"
.IX Title "PROVIDER-SKEYMGMT 7ossl"
.TH PROVIDER-SKEYMGMT 7ossl "2025-04-23" "3.5.1-dev" "OpenSSL"
.\" For nroff, turn off justification. Always turn off hyphenation; it makes
.\" way too many mistakes in technical documents.
.if n .ad l
.nh
.SH "NAME"
provider\-skeymgmt \- The SKEYMGMT library <\-> provider functions
.SH "SYNOPSIS"
.IX Header "SYNOPSIS"
.Vb 1
\& #include <openssl/core_dispatch.h>
\&
\& /*
\& * None of these are actual functions, but are displayed like this for
\& * the function signatures for functions that are offered as function
\& * pointers in OSSL_DISPATCH arrays.
\& */
\&
\& /* Key object destruction */
\& void OSSL_FUNC_skeymgmt_free(void *keydata);
\&
\& /* Key object import and export functions */
\& void *OSSL_FUNC_skeymgmt_import(void *provctx, int selection,
\& const OSSL_PARAM params[]);
\& int OSSL_FUNC_skeymgmt_export(void *keydata, int selection,
\& OSSL_CALLBACK *param_cb, void *cbarg);
\& void *OSSL_FUNC_skeymgmt_generate(void *provctx,
\& const OSSL_PARAM params[]);
\& const OSSL_PARAM *OSSL_FUNC_skeymgmt_gen_settable_params(void *provctx);
\& const OSSL_PARAM *OSSL_FUNC_skeymgmt_imp_settable_params(void *provctx);
\& const char *OSSL_FUNC_skeymgmt_get_key_id(void *keydata);
.Ve
.SH "DESCRIPTION"
.IX Header "DESCRIPTION"
The \s-1SKEYMGMT\s0 operation doesn't have much public visibility in the OpenSSL
libraries, rather it is an internal operation that is designed to work
with operations that use opaque symmetric keys objects.
.PP
The \s-1SKEYMGMT\s0 operation shares knowledge with the operations it works with,
therefore the \s-1SKEYMGMT\s0 and the algorithms which use it must belong to the same
provider. The OpenSSL libraries will ensure that they do.
.PP
The primary responsibility of the \s-1SKEYMGMT\s0 operation is to hold the
provider side key data for the OpenSSL library \s-1EVP_SKEY\s0 structure.
.PP
All \*(L"functions\*(R" mentioned here are passed as function pointers between
\&\fIlibcrypto\fR and the provider in \s-1\fIOSSL_DISPATCH\s0\fR\|(3) arrays via
\&\s-1\fIOSSL_ALGORITHM\s0\fR\|(3) arrays that are returned by the provider's
\&\fIprovider_query_operation()\fR function
(see \*(L"Provider Functions\*(R" in \fIprovider\-base\fR\|(7)).
.PP
All these \*(L"functions\*(R" have a corresponding function type definition
named \fBOSSL_FUNC_{name}_fn\fR, and a helper function to retrieve the
function pointer from a \s-1\fIOSSL_DISPATCH\s0\fR\|(3) element named
\&\fBOSSL_FUNC_{name}\fR.
.PP
\&\s-1\fIOSSL_DISPATCH\s0\fR\|(3) arrays are indexed by numbers that are provided as
macros in \fIopenssl\-core_dispatch.h\fR\|(7), as follows:
.PP
.Vb 1
\& OSSL_FUNC_skeymgmt_free OSSL_FUNC_SKEYMGMT_FREE
\&
\& OSSL_FUNC_skeymgmt_import OSSL_FUNC_SKEYMGMT_IMPORT
\& OSSL_FUNC_skeymgmt_export OSSL_FUNC_SKEYMGMT_EXPORT
\&
\& OSSL_FUNC_skeymgmt_generate OSSL_FUNC_SKEYMGMT_GENERATE
\&
\& OSSL_FUNC_skeymgmt_get_key_id OSSL_FUNC_SKEYMGMT_GET_KEY_ID
\& OSSL_FUNC_skeymgmt_imp_settable_params OSSL_FUNC_SKEYMGMT_IMP_SETTABLE_PARAMS
\& OSSL_FUNC_skeymgmt_gen_settable_params OSSL_FUNC_SKEYMGMT_GEN_SETTABLE_PARAMS
.Ve
.PP
The \s-1SKEYMGMT\s0 management is inspired by \s-1KEYMGMT\s0 but is simpler.
.SS "Key Objects"
.IX Subsection "Key Objects"
A key object is a collection of data for an symmetric key, and is
represented as \fIkeydata\fR in this manual.
.PP
The exact contents of a key object are defined by the provider, and it
is assumed that different operations in one and the same provider use
the exact same structure to represent this collection of data, so that
for example, a key object that has been created using the \s-1SKEYMGMT\s0
interface can be passed as is to other algorithms from the same provider
operations, such as \fIOSSL_FUNC_mac_init_opaque()\fR (see
\&\fIprovider\-mac\fR\|(7)).
.PP
With the export \s-1SKEYMGMT\s0 function, it's possible to select a specific
subset of data to handle, governed by the bits in a \fIselection\fR
indicator. The bits are:
.IP "\fB\s-1OSSL_SKEYMGMT_SELECT_SECRET_KEY\s0\fR" 4
.IX Item "OSSL_SKEYMGMT_SELECT_SECRET_KEY"
Indicating that the secret key raw bytes in a key object should be
included.
.IP "\fB\s-1OSSL_SKEYMGMT_SELECT_PARAMETERS\s0\fR" 4
.IX Item "OSSL_SKEYMGMT_SELECT_PARAMETERS"
Indicating that the parameters in a key object should be
included.
.PP
Combined selector bits are also defined for easier use:
.IP "\fB\s-1OSSL_SKEYMGMT_SELECT_ALL\s0\fR" 4
.IX Item "OSSL_SKEYMGMT_SELECT_ALL"
Indicating that everything in a key object should be included.
.PP
The exact interpretation of those bits or how they combine is left to
each function where you can specify a selector.
.SS "Destructing Function"
.IX Subsection "Destructing Function"
\&\fIOSSL_FUNC_skeymgmt_free()\fR should free the passed \fIkeydata\fR.
.SS "Key Object Import and Export Functions"
.IX Subsection "Key Object Import and Export Functions"
\&\fIOSSL_FUNC_skeymgmt_import()\fR should import data into \fIkeydata\fR with values
taken from the \s-1\fIOSSL_PARAM\s0\fR\|(3) array \fIparams\fR. It allocates the \fIkeydata\fR
object (there is no separate allocation function).
.PP
\&\fIOSSL_FUNC_skeymgmt_imp_settable_params()\fR returns a list of parameters that can
be provided to the \fIOSSL_FUNC_skeymgmt_import()\fR function.
.PP
\&\fIOSSL_FUNC_skeymgmt_export()\fR should extract values indicated by \fIselection\fR
from \fIkeydata\fR, create an \s-1\fIOSSL_PARAM\s0\fR\|(3) array with them and call
\&\fIparam_cb\fR with that array as well as the given \fIcbarg\fR.
The passed \s-1\fIOSSL_PARAM\s0\fR\|(3) array is transient and is freed upon the return from \fIparam_cb\fR.
.SS "Key Object Generation Functions"
.IX Subsection "Key Object Generation Functions"
\&\fIOSSL_FUNC_skeymgmt_generate()\fR creates a new key according to the values
taken from the \s-1\fIOSSL_PARAM\s0\fR\|(3) array \fIparams\fR. It allocates the \fIkeydata\fR
object.
.PP
\&\fIOSSL_FUNC_skeymgmt_gen_settable_params()\fR returns a list of parameters that can
be provided to the \fIOSSL_FUNC_skeymgmt_generate()\fR function.
.SS "Key Object Information functions"
.IX Subsection "Key Object Information functions"
\&\fIOSSL_FUNC_skeymgmt_get_key_id()\fR returns a NUL-terminated string identifying the
particular key. The returned string will be freed by a call to \fIEVP_SKEY_free()\fR
so callers need to copy it themselves if they want to preserve the value past
the key lifetime. The purpose of this function is providing a printable string
that can help users to access the specific key. The content of this string is
provider-specific.
.SS "Common Import and Export Parameters"
.IX Subsection "Common Import and Export Parameters"
See \s-1\fIOSSL_PARAM\s0\fR\|(3) for further details on the parameters structure.
.PP
Common information parameters currently recognised by built-in
skeymgmt algorithms are as follows:
.ie n .IP """raw-bytes"" (\fB\s-1SKEY_PARAM_RAW_BYTES\s0\fR) <octet string>" 4
.el .IP "``raw-bytes'' (\fB\s-1SKEY_PARAM_RAW_BYTES\s0\fR) <octet string>" 4
.IX Item "raw-bytes (SKEY_PARAM_RAW_BYTES) <octet string>"
The value represents symmetric key as a byte array.
.ie n .IP """key-length"" (\fB\s-1SKEY_PARAM_KEY_LENGTH\s0\fR) <integer>" 4
.el .IP "``key-length'' (\fB\s-1SKEY_PARAM_KEY_LENGTH\s0\fR) <integer>" 4
.IX Item "key-length (SKEY_PARAM_KEY_LENGTH) <integer>"
The value is the byte length of the given key.
.SH "RETURN VALUES"
.IX Header "RETURN VALUES"
\&\fIOSSL_FUNC_skeymgmt_import()\fR and \fIOSSL_FUNC_skeymgmt_generate()\fR return a pointer
to an allocated object on success and \s-1NULL\s0 on error.
.PP
\&\fIOSSL_FUNC_skeymgmt_export()\fR returns 1 for success or 0 on error.
.PP
\&\fIOSSL_FUNC_skeymgmt_get_key_id()\fR returns a pointer to a 0\-terminated string or \s-1NULL.\s0
.PP
\&\fIOSSL_FUNC_skeymgmt_gen_settable_params()\fR and \fIOSSL_FUNC_skeymgmt_imp_settable_params()\fR
return references to an array of \fB\s-1OSSL_PARAM\s0\fR which can be \s-1NULL\s0 if there are
no settable parameters.
.SH "SEE ALSO"
.IX Header "SEE ALSO"
\&\fIprovider\fR\|(7), \s-1\fIEVP_SKEY\s0\fR\|(3), \s-1\fIEVP_KEYMGMT\s0\fR\|(3)
.SH "HISTORY"
.IX Header "HISTORY"
The \s-1SKEYMGMT\s0 interface was introduced in OpenSSL 3.5.
.SH "COPYRIGHT"
.IX Header "COPYRIGHT"
Copyright 2024\-2025 The OpenSSL Project Authors. All Rights Reserved.
.PP
Licensed under the Apache License 2.0 (the \*(L"License\*(R"). You may not use
this file except in compliance with the License. You can obtain a copy
in the file \s-1LICENSE\s0 in the source distribution or at
<https://www.openssl.org/source/license.html>.