openssl-prebuild/linux_amd64/ssl/share/man/man7/provider-keymgmt.7
2020-03-02 16:50:34 +00:00

518 lines
23 KiB
Groff
Executable File

.\" Automatically generated by Pod::Man 2.25 (Pod::Simple 3.16)
.\"
.\" 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" ''
'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.
.ie \nF \{\
. de IX
. tm Index:\\$1\t\\n%\t"\\$2"
..
. nr % 0
. rr F
.\}
.el \{\
. de IX
..
.\}
.\"
.\" 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-KEYMGMT 7"
.TH PROVIDER-KEYMGMT 7 "2020-03-02" "3.0.0-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\-keymgmt \- The KEYMGMT library <\-> provider functions
.SH "SYNOPSIS"
.IX Header "SYNOPSIS"
.Vb 1
\& #include <openssl/core_numbers.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 (keydata) creation and destruction */
\& void *OP_keymgmt_new(void *provctx);
\& void OP_keymgmt_free(void *keydata);
\&
\& /* Key object information */
\& int OP_keymgmt_get_params(void *keydata, OSSL_PARAM params[]);
\& const OSSL_PARAM *OP_keymgmt_gettable_params(void);
\& int OP_keymgmt_set_params(void *keydata, const OSSL_PARAM params[]);
\& const OSSL_PARAM *OP_keymgmt_settable_params(void);
\&
\& /* Key object content checks */
\& int OP_keymgmt_has(void *keydata, int selection);
\& int OP_keymgmt_match(const void *keydata1, const void *keydata2,
\& int selection);
\&
\& /* Discovery of supported operations */
\& const char *OP_keymgmt_query_operation_name(int operation_id);
\&
\& /* Key object import and export functions */
\& int OP_keymgmt_import(int selection, void *keydata, const OSSL_PARAM params[]);
\& const OSSL_PARAM *OP_keymgmt_import_types(int selection);
\& int OP_keymgmt_export(int selection, void *keydata,
\& OSSL_CALLBACK *param_cb, void *cbarg);
\& const OSSL_PARAM *OP_keymgmt_export_types(int selection);
\&
\& /* Key object copy */
\& int OP_keymgmt_copy(void *keydata_to, const void *keydata_from, int selection);
\&
\& /* Key object validation */
\& int OP_keymgmt_validate(void *keydata, int selection);
.Ve
.SH "DESCRIPTION"
.IX Header "DESCRIPTION"
The \s-1KEYMGMT\s0 operation doesn't have much public visibility in OpenSSL
libraries, it's rather an internal operation that's designed to work
in tandem with operations that use private/public key pairs.
.PP
Because the \s-1KEYMGMT\s0 operation shares knowledge with the operations it
works with in tandem, they must belong to the same provider.
The OpenSSL libraries will ensure that they do.
.PP
The primary responsibility of the \s-1KEYMGMT\s0 operation is to hold the
provider side key data for the OpenSSL library \s-1EVP_PKEY\s0 structure.
.PP
All \*(L"functions\*(R" mentioned here are passed as function pointers between
\&\fIlibcrypto\fR and the provider in \fB\s-1OSSL_DISPATCH\s0\fR arrays via
\&\fB\s-1OSSL_ALGORITHM\s0\fR 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_{name}_fn\fR, and a helper function to retrieve the
function pointer from a \fB\s-1OSSL_DISPATCH\s0\fR element named
\&\fBOSSL_get_{name}\fR.
For example, the \*(L"function\*(R" \fIOP_keymgmt_new()\fR has these:
.PP
.Vb 3
\& typedef void *(OSSL_OP_keymgmt_new_fn)(void *provctx);
\& static ossl_inline OSSL_OP_keymgmt_new_fn
\& OSSL_get_OP_keymgmt_new(const OSSL_DISPATCH *opf);
.Ve
.PP
\&\fB\s-1OSSL_DISPATCH\s0\fR arrays are indexed by numbers that are provided as
macros in \fIopenssl\-core_numbers.h\fR\|(7), as follows:
.PP
.Vb 2
\& OP_keymgmt_new OSSL_FUNC_KEYMGMT_NEW
\& OP_keymgmt_free OSSL_FUNC_KEYMGMT_FREE
\&
\& OP_keymgmt_get_params OSSL_FUNC_KEYMGMT_GET_PARAMS
\& OP_keymgmt_gettable_params OSSL_FUNC_KEYMGMT_GETTABLE_PARAMS
\& OP_keymgmt_set_params OSSL_FUNC_KEYMGMT_SET_PARAMS
\& OP_keymgmt_settable_params OSSL_FUNC_KEYMGMT_SETTABLE_PARAMS
\&
\& OP_keymgmt_query_operation_name OSSL_FUNC_KEYMGMT_QUERY_OPERATION_NAME
\&
\& OP_keymgmt_has OSSL_FUNC_KEYMGMT_HAS
\& OP_keymgmt_validate OSSL_FUNC_KEYMGMT_VALIDATE
\& OP_keymgmt_match OSSL_FUNC_KEYMGMT_MATCH
\&
\& OP_keymgmt_import OSSL_FUNC_KEYMGMT_IMPORT
\& OP_keymgmt_import_types OSSL_FUNC_KEYMGMT_IMPORT_TYPES
\& OP_keymgmt_export OSSL_FUNC_KEYMGMT_EXPORT
\& OP_keymgmt_export_types OSSL_FUNC_KEYMGMT_EXPORT_TYPES
\&
\& OP_keymgmt_copy OSSL_FUNC_KEYMGMT_COPY
.Ve
.SS "Key Objects"
.IX Subsection "Key Objects"
A key object is a collection of data for an asymmetric 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-1KEYMGMT\s0
interface that we document here can be passed as is to other provider
operations, such as \fIOP_signature_sign_init()\fR (see
\&\fIprovider\-signature\fR\|(7)).
.PP
With some of the \s-1KEYMGMT\s0 functions, 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_KEYMGMT_SELECT_PRIVATE_KEY\s0\fR" 4
.IX Item "OSSL_KEYMGMT_SELECT_PRIVATE_KEY"
Indicating that the private key data in a key object should be
considered.
.IP "\fB\s-1OSSL_KEYMGMT_SELECT_PUBLIC_KEY\s0\fR" 4
.IX Item "OSSL_KEYMGMT_SELECT_PUBLIC_KEY"
Indicating that the public key data in a key object should be
considered.
.IP "\fB\s-1OSSL_KEYMGMT_SELECT_DOMAIN_PARAMETERS\s0\fR" 4
.IX Item "OSSL_KEYMGMT_SELECT_DOMAIN_PARAMETERS"
Indicating that the domain parameters in a key object should be
considered.
.IP "\fB\s-1OSSL_KEYMGMT_SELECT_OTHER_PARAMETERS\s0\fR" 4
.IX Item "OSSL_KEYMGMT_SELECT_OTHER_PARAMETERS"
Indicating that other parameters in a key object should be
considered.
.Sp
Other parameters are key parameters that don't fit any other
classification. In other words, this particular selector bit works as
a last resort bit bucket selector.
.PP
Some selector bits have also been combined for easier use:
.IP "\fB\s-1OSSL_KEYMGMT_SELECT_ALL_PARAMETERS\s0\fR" 4
.IX Item "OSSL_KEYMGMT_SELECT_ALL_PARAMETERS"
Indicating that all key object parameters should be considered,
regardless of their more granular classification.
.Sp
This is a combination of \fB\s-1OSSL_KEYMGMT_SELECT_DOMAIN_PARAMETERS\s0\fR and
\&\fB\s-1OSSL_KEYMGMT_SELECT_OTHER_PARAMETERS\s0\fR.
.IP "\fB\s-1OSSL_KEYMGMT_SELECT_KEYPAIR\s0\fR" 4
.IX Item "OSSL_KEYMGMT_SELECT_KEYPAIR"
Indicating that both the whole key pair in a key object should be
considered, i.e. the combination of public and private key.
.Sp
This is a combination of \fB\s-1OSSL_KEYMGMT_SELECT_PRIVATE_KEY\s0\fR and
\&\fB\s-1OSSL_KEYMGMT_SELECT_PUBLIC_KEY\s0\fR.
.IP "\fB\s-1OSSL_KEYMGMT_SELECT_ALL\s0\fR" 4
.IX Item "OSSL_KEYMGMT_SELECT_ALL"
Indicating that everything in a key object should be considered.
.PP
The exact interpretation of those bits or how they combine is left to
each function where you can specify a selector.
.SS "Constructing and Destructing Functions"
.IX Subsection "Constructing and Destructing Functions"
\&\fIOP_keymgmt_new()\fR should create a provider side key object. The
provider context \fIprovctx\fR is passed and may be incorporated in the
key object, but that is not mandatory.
.PP
\&\fIOP_keymgmt_free()\fR should free the passed \fIkeydata\fR.
.PP
The constructor and destructor are mandatory, a \s-1KEYMGMT\s0 implementation
without them will not be accepted.
.SS "Key Object Information Functions"
.IX Subsection "Key Object Information Functions"
\&\fIOP_keymgmt_get_params()\fR should extract information data associated
with the given \fIkeydata\fR, see \*(L"Information Parameters\*(R".
.PP
\&\fIOP_keymgmt_gettable_params()\fR should return a constant array of
descriptor \fB\s-1OSSL_PARAM\s0\fR, for parameters that \fIOP_keymgmt_get_params()\fR
can handle.
.PP
If \fIOP_keymgmt_gettable_params()\fR is present, \fIOP_keymgmt_get_params()\fR
must also be present, and vice versa.
.PP
\&\fIOP_keymgmt_set_params()\fR should update information data associated
with the given \fIkeydata\fR, see \*(L"Information Parameters\*(R".
.PP
\&\fIOP_keymgmt_settable_params()\fR should return a constant array of
descriptor \fB\s-1OSSL_PARAM\s0\fR, for parameters that \fIOP_keymgmt_set_params()\fR
can handle.
.PP
If \fIOP_keymgmt_settable_params()\fR is present, \fIOP_keymgmt_set_params()\fR
must also be present, and vice versa.
.SS "Key Object Checking Functions"
.IX Subsection "Key Object Checking Functions"
\&\fIOP_keymgmt_query_operation_name()\fR should return the name of the
supported algorithm for the operation \fIoperation_id\fR. This is
similar to \fIprovider_query_operation()\fR (see \fIprovider\-base\fR\|(7)),
but only works as an advisory. If this function is not present, or
returns \s-1NULL\s0, the caller is free to assume that there's an algorithm
from the same provider, of the same name as the one used to fetch the
keymgmt and try to use that.
.PP
\&\fIOP_keymgmt_has()\fR should check whether the given \fIkeydata\fR contains the subsets
of data indicated by the \fIselector\fR. A combination of several
selector bits must consider all those subsets, not just one. An
implementation is, however, free to consider an empty subset of data
to still be a valid subset.
.PP
\&\fIOP_keymgmt_validate()\fR should check if the \fIkeydata\fR contains valid
data subsets indicated by \fIselection\fR. Some combined selections of
data subsets may cause validation of the combined data.
For example, the combination of \fB\s-1OSSL_KEYMGMT_SELECT_PRIVATE_KEY\s0\fR and
\&\fB\s-1OSSL_KEYMGMT_SELECT_PUBLIC_KEY\s0\fR (or \fB\s-1OSSL_KEYMGMT_SELECT_KEYPAIR\s0\fR
for short) is expected to check that the pairwise consistency of
\&\fIkeydata\fR is valid.
.PP
\&\fIOP_keymgmt_match()\fR should check if the data subset indicated by
\&\fIselection\fR in \fIkeydata1\fR and \fIkeydata2\fR match. It is assumed that
the caller has ensured that \fIkeydata1\fR and \fIkeydata2\fR are both owned
by the implementation of this function.
.SS "Key Object Import, Export and Copy Functions"
.IX Subsection "Key Object Import, Export and Copy Functions"
\&\fIOP_keymgmt_import()\fR should import data indicated by \fIselection\fR into
\&\fIkeydata\fR with values taken from the \fB\s-1OSSL_PARAM\s0\fR array \fIparams\fR.
.PP
\&\fIOP_keymgmt_export()\fR should extract values indicated by \fIselection\fR
from \fIkeydata\fR, create an \fB\s-1OSSL_PARAM\s0\fR array with them and call
\&\fIparam_cb\fR with that array as well as the given \fIcbarg\fR.
.PP
\&\fIOP_keymgmt_import_types()\fR should return a constant array of descriptor
\&\fB\s-1OSSL_PARAM\s0\fR for data indicated by \fIselection\fR, for parameters that
\&\fIOP_keymgmt_import()\fR can handle.
.PP
\&\fIOP_keymgmt_export_types()\fR should return a constant array of descriptor
\&\fB\s-1OSSL_PARAM\s0\fR for data indicated by \fIselection\fR, that the
\&\fIOP_keymgmt_export()\fR callback can expect to receive.
.PP
\&\fIOP_keymgmt_copy()\fR should copy data subsets indicated by \fIselection\fR
from \fIkeydata_from\fR to \fIkeydata_to\fR. It is assumed that the caller
has ensured that \fIkeydata_to\fR and \fIkeydata_from\fR are both owned by
the implementation of this function.
.SS "Built-in \s-1RSA\s0 Import/Export Types"
.IX Subsection "Built-in RSA Import/Export Types"
The following Import/Export types are available for the built-in \s-1RSA\s0 algorithm:
.ie n .IP """n"" (\fB\s-1OSSL_PKEY_PARAM_RSA_N\s0\fR) <integer>" 4
.el .IP "``n'' (\fB\s-1OSSL_PKEY_PARAM_RSA_N\s0\fR) <integer>" 4
.IX Item "n (OSSL_PKEY_PARAM_RSA_N) <integer>"
The \s-1RSA\s0 \*(L"n\*(R" value.
.ie n .IP """e"" (\fB\s-1OSSL_PKEY_PARAM_RSA_E\s0\fR) <integer>" 4
.el .IP "``e'' (\fB\s-1OSSL_PKEY_PARAM_RSA_E\s0\fR) <integer>" 4
.IX Item "e (OSSL_PKEY_PARAM_RSA_E) <integer>"
The \s-1RSA\s0 \*(L"e\*(R" value.
.ie n .IP """d"" (\fB\s-1OSSL_PKEY_PARAM_RSA_D\s0\fR) <integer>" 4
.el .IP "``d'' (\fB\s-1OSSL_PKEY_PARAM_RSA_D\s0\fR) <integer>" 4
.IX Item "d (OSSL_PKEY_PARAM_RSA_D) <integer>"
The \s-1RSA\s0 \*(L"d\*(R" value.
.ie n .IP """rsa-factor"" (\fB\s-1OSSL_PKEY_PARAM_RSA_FACTOR\s0\fR) <integer>" 4
.el .IP "``rsa-factor'' (\fB\s-1OSSL_PKEY_PARAM_RSA_FACTOR\s0\fR) <integer>" 4
.IX Item "rsa-factor (OSSL_PKEY_PARAM_RSA_FACTOR) <integer>"
An \s-1RSA\s0 factor. In 2 prime \s-1RSA\s0 these are often known as \*(L"p\*(R" or \*(L"q\*(R". This value
may be repeated up to 10 times in a single key.
.ie n .IP """rsa-exponent"" (\fB\s-1OSSL_PKEY_PARAM_RSA_EXPONENT\s0\fR) <integer>" 4
.el .IP "``rsa-exponent'' (\fB\s-1OSSL_PKEY_PARAM_RSA_EXPONENT\s0\fR) <integer>" 4
.IX Item "rsa-exponent (OSSL_PKEY_PARAM_RSA_EXPONENT) <integer>"
An \s-1RSA\s0 \s-1CRT\s0 (Chinese Remainder Theorem) exponent. This value may be repeated up
to 10 times in a single key.
.ie n .IP """rsa-coefficient"" (\fB\s-1OSSL_PKEY_PARAM_RSA_COEFFICIENT\s0\fR) <integer>" 4
.el .IP "``rsa-coefficient'' (\fB\s-1OSSL_PKEY_PARAM_RSA_COEFFICIENT\s0\fR) <integer>" 4
.IX Item "rsa-coefficient (OSSL_PKEY_PARAM_RSA_COEFFICIENT) <integer>"
An \s-1RSA\s0 \s-1CRT\s0 (Chinese Remainder Theorem) coefficient. This value may be repeated
up to 9 times in a single key.
.SS "Built-in \s-1DSA\s0 and Diffie-Hellman Import/Export Types"
.IX Subsection "Built-in DSA and Diffie-Hellman Import/Export Types"
The following Import/Export types are available for the built-in \s-1DSA\s0 and
Diffie-Hellman algorithms:
.ie n .IP """pub"" (\fB\s-1OSSL_PKEY_PARAM_PUB_KEY\s0\fR) <integer> or <octet string>" 4
.el .IP "``pub'' (\fB\s-1OSSL_PKEY_PARAM_PUB_KEY\s0\fR) <integer> or <octet string>" 4
.IX Item "pub (OSSL_PKEY_PARAM_PUB_KEY) <integer> or <octet string>"
The public key value.
.ie n .IP """priv"" (\fB\s-1OSSL_PKEY_PARAM_PRIV_KEY\s0\fR) <integer> or <octet string>" 4
.el .IP "``priv'' (\fB\s-1OSSL_PKEY_PARAM_PRIV_KEY\s0\fR) <integer> or <octet string>" 4
.IX Item "priv (OSSL_PKEY_PARAM_PRIV_KEY) <integer> or <octet string>"
The private key value.
.ie n .IP """p"" (\fB\s-1OSSL_PKEY_PARAM_FFC_P\s0\fR) <integer>" 4
.el .IP "``p'' (\fB\s-1OSSL_PKEY_PARAM_FFC_P\s0\fR) <integer>" 4
.IX Item "p (OSSL_PKEY_PARAM_FFC_P) <integer>"
A \s-1DSA\s0 or Diffie-Hellman \*(L"p\*(R" value.
.ie n .IP """q"" (\fB\s-1OSSL_PKEY_PARAM_FFC_Q\s0\fR) <integer>" 4
.el .IP "``q'' (\fB\s-1OSSL_PKEY_PARAM_FFC_Q\s0\fR) <integer>" 4
.IX Item "q (OSSL_PKEY_PARAM_FFC_Q) <integer>"
A \s-1DSA\s0 or Diffie-Hellman \*(L"q\*(R" value.
.ie n .IP """g"" (\fB\s-1OSSL_PKEY_PARAM_FFC_G\s0\fR) <integer>" 4
.el .IP "``g'' (\fB\s-1OSSL_PKEY_PARAM_FFC_G\s0\fR) <integer>" 4
.IX Item "g (OSSL_PKEY_PARAM_FFC_G) <integer>"
A \s-1DSA\s0 or Diffie-Hellman \*(L"g\*(R" value.
.SS "Built-in X25519, X448, \s-1ED25519\s0 and \s-1ED448\s0 Import/Export Types"
.IX Subsection "Built-in X25519, X448, ED25519 and ED448 Import/Export Types"
The following Import/Export types are available for the built-in X25519, X448,
\&\s-1ED25519\s0 and X448 algorithms:
.ie n .IP """pub"" (\fB\s-1OSSL_PKEY_PARAM_PUB_KEY\s0\fR) <octet string>" 4
.el .IP "``pub'' (\fB\s-1OSSL_PKEY_PARAM_PUB_KEY\s0\fR) <octet string>" 4
.IX Item "pub (OSSL_PKEY_PARAM_PUB_KEY) <octet string>"
The public key value.
.ie n .IP """priv"" (\fB\s-1OSSL_PKEY_PARAM_PRIV_KEY\s0\fR) <octet string>" 4
.el .IP "``priv'' (\fB\s-1OSSL_PKEY_PARAM_PRIV_KEY\s0\fR) <octet string>" 4
.IX Item "priv (OSSL_PKEY_PARAM_PRIV_KEY) <octet string>"
The private key value.
.SS "Information Parameters"
.IX Subsection "Information Parameters"
See \s-1\fIOSSL_PARAM\s0\fR\|(3) for further details on the parameters structure.
.PP
Parameters currently recognised by built-in keymgmt algorithms
are as follows.
Not all parameters are relevant to, or are understood by all keymgmt
algorithms:
.ie n .IP """bits"" (\fB\s-1OSSL_PKEY_PARAM_BITS\s0\fR) <integer>" 4
.el .IP "``bits'' (\fB\s-1OSSL_PKEY_PARAM_BITS\s0\fR) <integer>" 4
.IX Item "bits (OSSL_PKEY_PARAM_BITS) <integer>"
The value should be the cryptographic length of the cryptosystem to
which the key belongs, in bits. The definition of cryptographic
length is specific to the key cryptosystem.
.ie n .IP """max-size"" (\fB\s-1OSSL_PKEY_PARAM_MAX_SIZE\s0\fR) <integer>" 4
.el .IP "``max-size'' (\fB\s-1OSSL_PKEY_PARAM_MAX_SIZE\s0\fR) <integer>" 4
.IX Item "max-size (OSSL_PKEY_PARAM_MAX_SIZE) <integer>"
The value should be the maximum size that a caller should allocate to
safely store a signature (called \fIsig\fR in \fIprovider\-signature\fR\|(7)),
the result of asymmmetric encryption / decryption (\fIout\fR in
\&\fIprovider\-asym_cipher\fR\|(7), a derived secret (\fIsecret\fR in
\&\fIprovider\-keyexch\fR\|(7), and similar data).
.Sp
Because an \s-1EVP_KEYMGMT\s0 method is always tightly bound to another method
(signature, asymmetric cipher, key exchange, ...) and must be of the
same provider, this number only needs to be synchronised with the
dimensions handled in the rest of the same provider.
.ie n .IP """security-bits"" (\fB\s-1OSSL_PKEY_PARAM_SECURITY_BITS\s0\fR) <integer>" 4
.el .IP "``security-bits'' (\fB\s-1OSSL_PKEY_PARAM_SECURITY_BITS\s0\fR) <integer>" 4
.IX Item "security-bits (OSSL_PKEY_PARAM_SECURITY_BITS) <integer>"
The value should be the number of security bits of the given key.
Bits of security is defined in \s-1SP800\-57\s0.
.ie n .IP """use-cofactor-flag"" (\fB\s-1OSSL_PKEY_PARAM_USE_COFACTOR_FLAG\s0\fR, \fB\s-1OSSL_PKEY_PARAM_USE_COFACTOR_ECDH\s0\fR) <integer>" 4
.el .IP "``use-cofactor-flag'' (\fB\s-1OSSL_PKEY_PARAM_USE_COFACTOR_FLAG\s0\fR, \fB\s-1OSSL_PKEY_PARAM_USE_COFACTOR_ECDH\s0\fR) <integer>" 4
.IX Item "use-cofactor-flag (OSSL_PKEY_PARAM_USE_COFACTOR_FLAG, OSSL_PKEY_PARAM_USE_COFACTOR_ECDH) <integer>"
The value should be either 1 or 0, to respectively enable or disable
use of the cofactor in operations using this key.
.Sp
In the context of a key that can be used to perform an Elliptic Curve
Diffie-Hellman key exchange, this parameter can be used to mark a requirement
for using the Cofactor Diffie-Hellman (\s-1CDH\s0) variant of the key exchange
algorithm.
.Sp
See also \fIprovider\-keyexch\fR\|(7) for the related
\&\fB\s-1OSSL_EXCHANGE_PARAM_EC_ECDH_COFACTOR_MODE\s0\fR parameter that can be set on a
per-operation basis.
.SH "RETURN VALUES"
.IX Header "RETURN VALUES"
\&\fIOP_keymgmt_new()\fR should return a valid reference to the newly created provider
side key object, or \s-1NULL\s0 on failure.
.PP
\&\fIOP_keymgmt_import()\fR, \fIOP_keymgmt_export()\fR, \fIOP_keymgmt_get_params()\fR and
\&\fIOP_keymgmt_set_params()\fR should return 1 for success or 0 on error.
.PP
\&\fIOP_keymgmt_validate()\fR should return 1 on successful validation, or 0 on
failure.
.PP
\&\fIOP_keymgmt_has()\fR should return 1 if all the selected data subsets are contained
in the given \fIkeydata\fR or 0 otherwise.
.PP
\&\fIOP_keymgmt_query_operation_name()\fR should return a pointer to a string matching
the requested operation, or \s-1NULL\s0 if the same name used to fetch the keymgmt
applies.
.PP
\&\fIOP_keymgmt_gettable_params()\fR and \fIOP_keymgmt_settable_params()\fR
\&\fIOP_keymgmt_import_types()\fR, \fIOP_keymgmt_export_types()\fR
should
always return a constant \fB\s-1OSSL_PARAM\s0\fR array.
.SH "SEE ALSO"
.IX Header "SEE ALSO"
\&\fIprovider\fR\|(7)
.SH "HISTORY"
.IX Header "HISTORY"
The \s-1KEYMGMT\s0 interface was introduced in OpenSSL 3.0.
.SH "COPYRIGHT"
.IX Header "COPYRIGHT"
Copyright 2019\-2020 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>.