{"id":3941,"date":"2022-12-20T17:28:28","date_gmt":"2022-12-20T20:28:28","guid":{"rendered":"http:\/\/lode.uno\/linux-man\/index.php\/2022\/12\/20\/x25519-man7-2\/"},"modified":"2022-12-20T17:28:28","modified_gmt":"2022-12-20T20:28:28","slug":"x25519-man7-2","status":"publish","type":"post","link":"https:\/\/lode.uno\/linux-man\/2022\/12\/20\/x25519-man7-2\/","title":{"rendered":"X25519 (man7)"},"content":{"rendered":"<h1 align=\"center\">X25519<\/h1>\n<p> <a href=\"#NAME\">NAME<\/a><br \/> <a href=\"#DESCRIPTION\">DESCRIPTION<\/a><br \/> <a href=\"#NOTES\">NOTES<\/a><br \/> <a href=\"#EXAMPLES\">EXAMPLES<\/a><br \/> <a href=\"#SEE ALSO\">SEE ALSO<\/a><br \/> <a href=\"#COPYRIGHT\">COPYRIGHT<\/a> <\/p>\n<hr>\n<h2>NAME <a name=\"NAME\"><\/a> <\/h2>\n<p style=\"margin-left:11%; margin-top: 1em\">X25519, X448 \u2212 EVP_PKEY X25519 and X448 support<\/p>\n<h2>DESCRIPTION <a name=\"DESCRIPTION\"><\/a> <\/h2>\n<p style=\"margin-left:11%; margin-top: 1em\">The <b>X25519<\/b> and <b>X448<\/b> <small>EVP_PKEY<\/small> implementation supports key generation and key derivation using <b>X25519<\/b> and <b>X448<\/b>. It has associated private and public key formats compatible with <small>RFC 8410.<\/small><\/p>\n<p style=\"margin-left:11%; margin-top: 1em\">No additional parameters can be set during key generation.<\/p>\n<p style=\"margin-left:11%; margin-top: 1em\">The peer public key must be set using <b>EVP_PKEY_derive_set_peer()<\/b> when performing key derivation.<\/p>\n<h2>NOTES <a name=\"NOTES\"><\/a> <\/h2>\n<p style=\"margin-left:11%; margin-top: 1em\">A context for the <b>X25519<\/b> algorithm can be obtained by calling:<\/p>\n<p style=\"margin-left:11%; margin-top: 1em\">EVP_PKEY_CTX *pctx = EVP_PKEY_CTX_new_id(EVP_PKEY_X25519, NULL);<\/p>\n<p style=\"margin-left:11%; margin-top: 1em\">For the <b>X448<\/b> algorithm a context can be obtained by calling:<\/p>\n<p style=\"margin-left:11%; margin-top: 1em\">EVP_PKEY_CTX *pctx = EVP_PKEY_CTX_new_id(EVP_PKEY_X448, NULL);<\/p>\n<p style=\"margin-left:11%; margin-top: 1em\">X25519 or X448 private keys can be set directly using <b>EVP_PKEY_new_raw_private_key<\/b>(3) or loaded from a PKCS#8 private key file using <b>PEM_read_bio_PrivateKey<\/b>(3) (or similar function). Completely new keys can also be generated (see the example below). Setting a private key also sets the associated public key.<\/p>\n<p style=\"margin-left:11%; margin-top: 1em\">X25519 or X448 public keys can be set directly using <b>EVP_PKEY_new_raw_public_key<\/b>(3) or loaded from a SubjectPublicKeyInfo structure in a <small>PEM<\/small> file using <b>PEM_read_bio_PUBKEY<\/b>(3) (or similar function).<\/p>\n<h2>EXAMPLES <a name=\"EXAMPLES\"><\/a> <\/h2>\n<p style=\"margin-left:11%; margin-top: 1em\">This example generates an <b>X25519<\/b> private key and writes it to standard output in <small>PEM<\/small> format:<\/p>\n<p style=\"margin-left:11%; margin-top: 1em\">#include <openssl\/evp.h> <br \/> #include <openssl\/pem.h> <br \/> &#8230; <br \/> EVP_PKEY *pkey = NULL; <br \/> EVP_PKEY_CTX *pctx = EVP_PKEY_CTX_new_id(EVP_PKEY_X25519, NULL); <br \/> EVP_PKEY_keygen_init(pctx); <br \/> EVP_PKEY_keygen(pctx, &#038;pkey); <br \/> EVP_PKEY_CTX_free(pctx); <br \/> PEM_write_PrivateKey(stdout, pkey, NULL, NULL, 0, NULL, NULL);<\/p>\n<p style=\"margin-left:11%; margin-top: 1em\">The key derivation example in <b>EVP_PKEY_derive<\/b>(3) can be used with <b>X25519<\/b> and <b>X448<\/b>.<\/p>\n<h2>SEE ALSO <a name=\"SEE ALSO\"><\/a> <\/h2>\n<p style=\"margin-left:11%; margin-top: 1em\"><b>EVP_PKEY_CTX_new<\/b>(3), <b>EVP_PKEY_keygen<\/b>(3), <b>EVP_PKEY_derive<\/b>(3), <b>EVP_PKEY_derive_set_peer<\/b>(3)<\/p>\n<h2>COPYRIGHT <a name=\"COPYRIGHT\"><\/a> <\/h2>\n<p style=\"margin-left:11%; margin-top: 1em\">Copyright 2017\u22122020 The OpenSSL Project Authors. All Rights Reserved.<\/p>\n<p style=\"margin-left:11%; margin-top: 1em\">Licensed under the OpenSSL license (the &#8220;License&#8221;). You may not use this file except in compliance with the License. You can obtain a copy in the file <small>LICENSE<\/small> in the source distribution or at <https:\/\/www.openssl.org\/source\/license.html>.<\/p>\n<hr>\n","protected":false},"excerpt":{"rendered":"<p>  X25519, X448 \u2212 EVP_PKEY X25519 and X448 support <\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[971],"tags":[973,972,1033],"class_list":["post-3941","post","type-post","status-publish","format-standard","hentry","category-7-miscelanea","tag-973","tag-man7","tag-x25519"],"gutentor_comment":0,"_links":{"self":[{"href":"https:\/\/lode.uno\/linux-man\/wp-json\/wp\/v2\/posts\/3941","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/lode.uno\/linux-man\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/lode.uno\/linux-man\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/lode.uno\/linux-man\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/lode.uno\/linux-man\/wp-json\/wp\/v2\/comments?post=3941"}],"version-history":[{"count":0,"href":"https:\/\/lode.uno\/linux-man\/wp-json\/wp\/v2\/posts\/3941\/revisions"}],"wp:attachment":[{"href":"https:\/\/lode.uno\/linux-man\/wp-json\/wp\/v2\/media?parent=3941"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/lode.uno\/linux-man\/wp-json\/wp\/v2\/categories?post=3941"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/lode.uno\/linux-man\/wp-json\/wp\/v2\/tags?post=3941"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}