Standard preamble:
========================================================================
..
.... 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 -- \(*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\} . 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.
If the F register is >0, 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'.
.. .nr rF 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 . ds #H 0 . ds #V .8m . ds #F .3m . ds #[ \f1 . ds #] .\} . ds #H ((1u-(\\\\n(.fu%2u))*.13m) . ds #V .6m . ds #F 0 . ds #[ \& . ds #] \& .\} . \" simple accents for nroff and troff . ds ' \& . ds ` \& . ds ^ \& . ds , \& . ds ~ ~ . ds / .\} . 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 . \" corrections for vroff . \" for low resolution devices (crt and lpr) \{\ . 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 .\} ========================================================================
Title "EVP_PKEY_SET1_RSA 3"
way too many mistakes in technical documents.
\fBEVP_PKEY_get1_RSA(), EVP_PKEY_get1_DSA(), EVP_PKEY_get1_DH() and \fBEVP_PKEY_get1_EC_KEY() return the referenced key in pkey or \fB\s-1NULL\s0 if the key is not of the correct type.
\fBEVP_PKEY_get0_hmac(), EVP_PKEY_get0_poly1305(), EVP_PKEY_get0_siphash(), \fBEVP_PKEY_get0_RSA(), EVP_PKEY_get0_DSA(), EVP_PKEY_get0_DH() and EVP_PKEY_get0_EC_KEY() also return the referenced key in pkey or \s-1NULL\s0 if the key is not of the correct type but the reference count of the returned key is not incremented and so must not be freed up after use.
\fBEVP_PKEY_assign_RSA(), EVP_PKEY_assign_DSA(), EVP_PKEY_assign_DH(), \fBEVP_PKEY_assign_EC_KEY(), EVP_PKEY_assign_POLY1305() and \fBEVP_PKEY_assign_SIPHASH() also set the referenced key to key however these use the supplied key internally and so key will be freed when the parent pkey is freed.
\fBEVP_PKEY_base_id() returns the type of pkey. For example an \s-1RSA\s0 key will return \s-1EVP_PKEY_RSA\s0.
\fBEVP_PKEY_id() returns the actual \s-1OID\s0 associated with pkey. Historically keys using the same algorithm could use different OIDs. For example an \s-1RSA\s0 key could use the OIDs corresponding to the NIDs NID_rsaEncryption (equivalent to \fB\s-1EVP_PKEY_RSA\s0) or NID_rsa (equivalent to \s-1EVP_PKEY_RSA2\s0). The use of alternative non-standard OIDs is now rare so \s-1EVP_PKEY_RSA2\s0 et al are not often seen in practice.
\fBEVP_PKEY_type() returns the underlying type of the \s-1NID\s0 type. For example EVP_PKEY_type(\s-1EVP_PKEY_RSA2\s0) will return \s-1EVP_PKEY_RSA\s0.
\fBEVP_PKEY_get0_engine() returns a reference to the \s-1ENGINE\s0 handling pkey.
\fBEVP_PKEY_set1_engine() sets the \s-1ENGINE\s0 handling pkey to engine. It must be called after the key algorithm and components are set up. If engine does not include an \s-1EVP_PKEY_METHOD\s0 for pkey an error occurs.
\fBEVP_PKEY_set_alias_type() allows modifying a \s-1EVP_PKEY\s0 to use a different set of algorithms than the default. This is currently used to support \s-1SM2\s0 keys, which use an identical encoding to \s-1ECDSA.\s0
\fBEVP_PKEY_assign_RSA(), EVP_PKEY_assign_DSA(), EVP_PKEY_assign_DH(), \fBEVP_PKEY_assign_EC_KEY(), EVP_PKEY_assign_POLY1305() and EVP_PKEY_assign_SIPHASH() are implemented as macros.
Most applications wishing to know a key type will simply call \fBEVP_PKEY_base_id() and will not care about the actual type: which will be identical in almost all cases.
Previous versions of this document suggested using EVP_PKEY_type(pkey->type) to determine the type of a key. Since \s-1EVP_PKEY\s0 is now opaque this is no longer possible: the equivalent is EVP_PKEY_base_id(pkey).
\fBEVP_PKEY_set1_engine() is typically used by an \s-1ENGINE\s0 returning an \s-1HSM\s0 key as part of its routine to load a private key.
\fBEVP_PKEY_get1_RSA(), EVP_PKEY_get1_DSA(), EVP_PKEY_get1_DH() and \fBEVP_PKEY_get1_EC_KEY() return the referenced key or \s-1NULL\s0 if an error occurred.
\fBEVP_PKEY_assign_RSA(), EVP_PKEY_assign_DSA(), EVP_PKEY_assign_DH(), \fBEVP_PKEY_assign_EC_KEY(), EVP_PKEY_assign_POLY1305() and EVP_PKEY_assign_SIPHASH() return 1 for success and 0 for failure.
\fBEVP_PKEY_base_id(), EVP_PKEY_id() and EVP_PKEY_type() return a key type or NID_undef (equivalently \s-1EVP_PKEY_NONE\s0) on error.
\fBEVP_PKEY_set1_engine() returns 1 for success and 0 for failure.
\fBEVP_PKEY_set_alias_type() returns 1 for success and 0 for error.
.Vb 1 EVP_PKEY_set_alias_type(pkey, EVP_PKEY_SM2); .Ve
Licensed under the OpenSSL license (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>.