Automatically generated by Pod::Man 4.14 (Pod::Simple 3.40)

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_ENCODED_PUBLIC_KEY 3"
EVP_PKEY_SET1_ENCODED_PUBLIC_KEY 3 "2023-08-01" "3.0.10" "OpenSSL"
For nroff, turn off justification. Always turn off hyphenation; it makes
way too many mistakes in technical documents.
"NAME"
EVP_PKEY_set1_encoded_public_key, EVP_PKEY_get1_encoded_public_key, EVP_PKEY_set1_tls_encodedpoint, EVP_PKEY_get1_tls_encodedpoint \- functions to set and get public key data within an EVP_PKEY
"SYNOPSIS"
Header "SYNOPSIS" .Vb 1 #include <openssl/evp.h> \& int EVP_PKEY_set1_encoded_public_key(EVP_PKEY *pkey, const unsigned char *pub, size_t publen); \& size_t EVP_PKEY_get1_encoded_public_key(EVP_PKEY *pkey, unsigned char **ppub); .Ve

The following functions have been deprecated since OpenSSL 3.0, and can be hidden entirely by defining \s-1OPENSSL_API_COMPAT\s0 with a suitable version value, see openssl_user_macros\|(7):

.Vb 2 int EVP_PKEY_set1_tls_encodedpoint(EVP_PKEY *pkey, const unsigned char *pt, size_t ptlen); \& size_t EVP_PKEY_get1_tls_encodedpoint(EVP_PKEY *pkey, unsigned char **ppt); .Ve

"DESCRIPTION"
Header "DESCRIPTION" \fBEVP_PKEY_set1_encoded_public_key() can be used to set the public key value within an existing \s-1EVP_PKEY\s0 object. For the built-in OpenSSL algorithms this currently only works for those that support key exchange. Parameters are not set as part of this operation, so typically an application will create an \s-1EVP_PKEY\s0 first, set the parameters on it, and then call this function. For example setting the parameters might be done using \fBEVP_PKEY_copy_parameters\|(3).

The format for the encoded public key will depend on the algorithm in use. For \s-1DH\s0 it should be encoded as a positive integer in big-endian form. For \s-1EC\s0 is should be a point conforming to Sec. 2.3.4 of the \s-1SECG SEC 1\s0 (\*(L"Elliptic Curve Cryptography\*(R") standard. For X25519 and X448 it should be encoded in a format as defined by \s-1RFC7748.\s0

The key to be updated is supplied in pkey. The buffer containing the encoded key is pointed to be pub. The length of the buffer is supplied in publen.

\fBEVP_PKEY_get1_encoded_public_key() does the equivalent operation except that the encoded public key is returned to the application. The key containing the public key data is supplied in pkey. A buffer containing the encoded key will be allocated and stored in *ppub. The length of the encoded public key is returned by the function. The application is responsible for freeing the allocated buffer.

The macro EVP_PKEY_set1_tls_encodedpoint() is deprecated and simply calls \fBEVP_PKEY_set1_encoded_public_key() with all the same arguments. New applications should use EVP_PKEY_set1_encoded_public_key() instead.

The macro EVP_PKEY_get1_tls_encodedpoint() is deprecated and simply calls \fBEVP_PKEY_get1_encoded_public_key() with all the same arguments. New applications should use EVP_PKEY_get1_encoded_public_key() instead.

"RETURN VALUES"
Header "RETURN VALUES" \fBEVP_PKEY_set1_encoded_public_key() returns 1 for success and 0 or a negative value for failure.

\fBEVP_PKEY_get1_encoded_public_key() returns the length of the encoded key or 0 for failure.

"EXAMPLES"
Header "EXAMPLES" See EVP_PKEY_derive_init\|(3) and EVP_PKEY_derive\|(3) for information about performing a key exchange operation.
"Set up a peer's \s-1EVP_PKEY\s0 ready for a key exchange operation"
Subsection "Set up a peer's EVP_PKEY ready for a key exchange operation" .Vb 1 #include <openssl/evp.h> \& int exchange(EVP_PKEY *ourkey, unsigned char *peer_pub, size_t peer_pub_len) { EVP_PKEY *peerkey = EVP_PKEY_new(); \& if (peerkey == NULL || EVP_PKEY_copy_parameters(peerkey, ourkey) <= 0) return 0; \& if (EVP_PKEY_set1_encoded_public_key(peerkey, peer_pub, peer_pub_len) <= 0) return 0; \& /* Do the key exchange here */ \& EVP_PKEY_free(peerkey); \& return 1; } .Ve
"Get an encoded public key to send to a peer"
Subsection "Get an encoded public key to send to a peer" .Vb 1 #include <openssl/evp.h> \& int get_encoded_pub_key(EVP_PKEY *ourkey) { unsigned char *pubkey; size_t pubkey_len; \& pubkey_len = EVP_PKEY_get1_encoded_public_key(ourkey, &pubkey); if (pubkey_len == 0) return 0; \& /* * Send the encoded public key stored in the buffer at "pubkey" and of * length pubkey_len, to the peer. */ \& OPENSSL_free(pubkey); return 1; } .Ve
"SEE ALSO"
Header "SEE ALSO" \fBEVP_PKEY_new\|(3), EVP_PKEY_copy_parameters\|(3), \fBEVP_PKEY_derive_init\|(3), EVP_PKEY_derive\|(3), \s-1EVP_PKEY-DH\s0\|(7), \s-1EVP_PKEY-EC\s0\|(7), \s-1EVP_PKEY-X25519\s0\|(7), \s-1EVP_PKEY-X448\s0\|(7)
"HISTORY"
Header "HISTORY" \fBEVP_PKEY_set1_encoded_public_key() and EVP_PKEY_get1_encoded_public_key() were added in OpenSSL 3.0.

\fBEVP_PKEY_set1_tls_encodedpoint() and EVP_PKEY_get1_tls_encodedpoint() were deprecated in OpenSSL 3.0.

"COPYRIGHT"
Header "COPYRIGHT" Copyright 2020-2021 The OpenSSL Project Authors. All Rights Reserved.

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>.