openssl-prebuild/linux_amd64/share/doc/openssl/html/man7/X25519.html

105 lines
3.5 KiB
HTML
Executable File

<?xml version="1.0" ?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>X25519</title>
<meta http-equiv="content-type" content="text/html; charset=utf-8" />
<link rev="made" href="mailto:root@localhost" />
</head>
<body style="background-color: white">
<!-- INDEX BEGIN -->
<div name="index">
<p><a name="__index__"></a></p>
<ul>
<li><a href="#name">NAME</a></li>
<li><a href="#description">DESCRIPTION</a></li>
<li><a href="#notes">NOTES</a></li>
<li><a href="#examples">EXAMPLES</a></li>
<li><a href="#see_also">SEE ALSO</a></li>
<li><a href="#copyright">COPYRIGHT</a></li>
</ul>
<hr name="index" />
</div>
<!-- INDEX END -->
<p>
</p>
<hr />
<h1><a name="name">NAME</a></h1>
<p>X25519,
X448
- EVP_PKEY X25519 and X448 support</p>
<p>
</p>
<hr />
<h1><a name="description">DESCRIPTION</a></h1>
<p>The <strong>X25519</strong> and <strong>X448</strong> EVP_PKEY implementation supports key generation and
key derivation using <strong>X25519</strong> and <strong>X448</strong>. It has associated private and public
key formats compatible with draft-ietf-curdle-pkix-03.</p>
<p>No additional parameters can be set during key generation.</p>
<p>The peer public key must be set using <code>EVP_PKEY_derive_set_peer()</code> when
performing key derivation.</p>
<p>
</p>
<hr />
<h1><a name="notes">NOTES</a></h1>
<p>A context for the <strong>X25519</strong> algorithm can be obtained by calling:</p>
<pre>
EVP_PKEY_CTX *pctx = EVP_PKEY_CTX_new_id(EVP_PKEY_X25519, NULL);</pre>
<p>For the <strong>X448</strong> algorithm a context can be obtained by calling:</p>
<pre>
EVP_PKEY_CTX *pctx = EVP_PKEY_CTX_new_id(EVP_PKEY_X448, NULL);</pre>
<p>X25519 or X448 private keys can be set directly using
<em>EVP_PKEY_new_raw_private_key(3)</em> or loaded from a PKCS#8 private key file
using <em>PEM_read_bio_PrivateKey(3)</em> (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>
<p>X25519 or X448 public keys can be set directly using
<em>EVP_PKEY_new_raw_public_key(3)</em> or loaded from a SubjectPublicKeyInfo
structure in a PEM file using <em>PEM_read_bio_PUBKEY(3)</em> (or similar function).</p>
<p>
</p>
<hr />
<h1><a name="examples">EXAMPLES</a></h1>
<p>This example generates an <strong>X25519</strong> private key and writes it to standard
output in PEM format:</p>
<pre>
#include &lt;openssl/evp.h&gt;
#include &lt;openssl/pem.h&gt;
...
EVP_PKEY *pkey = NULL;
EVP_PKEY_CTX *pctx = EVP_PKEY_CTX_new_id(EVP_PKEY_X25519, NULL);
EVP_PKEY_keygen_init(pctx);
EVP_PKEY_keygen(pctx, &amp;pkey);
EVP_PKEY_CTX_free(pctx);
PEM_write_PrivateKey(stdout, pkey, NULL, NULL, 0, NULL, NULL);</pre>
<p>The key derivation example in <em>EVP_PKEY_derive(3)</em> can be used with
<strong>X25519</strong> and <strong>X448</strong>.</p>
<p>
</p>
<hr />
<h1><a name="see_also">SEE ALSO</a></h1>
<p><em>EVP_PKEY_CTX_new(3)</em>,
<em>EVP_PKEY_keygen(3)</em>,
<em>EVP_PKEY_derive(3)</em>,
<em>EVP_PKEY_derive_set_peer(3)</em></p>
<p>
</p>
<hr />
<h1><a name="copyright">COPYRIGHT</a></h1>
<p>Copyright 2017-2019 The OpenSSL Project Authors. All Rights Reserved.</p>
<p>Licensed under the OpenSSL license (the &quot;License&quot;). You may not use
this file except in compliance with the License. You can obtain a copy
in the file LICENSE in the source distribution or at
<a href="https://www.openssl.org/source/license.html">https://www.openssl.org/source/license.html</a>.</p>
</body>
</html>