man-pages/man7/X25519.7ssl.html
2021-03-31 01:06:50 +01:00

143 lines
4.0 KiB
HTML

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<HTML><HEAD><TITLE>Man page of X25519</TITLE>
</HEAD><BODY>
<H1>X25519</H1>
Section: OpenSSL (7SSL)<BR>Updated: 2021-03-22<BR><A HREF="#index">Index</A>
<A HREF="/cgi-bin/man/man2html">Return to Main Contents</A><HR>
<A NAME="lbAB">&nbsp;</A>
<H2>NAME</H2>
X25519, X448 - EVP_PKEY X25519 and X448 support
<A NAME="lbAC">&nbsp;</A>
<H2>DESCRIPTION</H2>
The <B>X25519</B> and <B>X448</B> <FONT SIZE="-1">EVP_PKEY</FONT> 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 <FONT SIZE="-1">RFC 8410.</FONT>
<P>
No additional parameters can be set during key generation.
<P>
The peer public key must be set using <B>EVP_PKEY_derive_set_peer()</B> when
performing key derivation.
<A NAME="lbAD">&nbsp;</A>
<H2>NOTES</H2>
A context for the <B>X25519</B> 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 <B>X448</B> 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
<B><A HREF="/cgi-bin/man/man2html?3+EVP_PKEY_new_raw_private_key">EVP_PKEY_new_raw_private_key</A></B>(3) or loaded from a PKCS#8 private key file
using <B><A HREF="/cgi-bin/man/man2html?3+PEM_read_bio_PrivateKey">PEM_read_bio_PrivateKey</A></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>
X25519 or X448 public keys can be set directly using
<B><A HREF="/cgi-bin/man/man2html?3+EVP_PKEY_new_raw_public_key">EVP_PKEY_new_raw_public_key</A></B>(3) or loaded from a SubjectPublicKeyInfo
structure in a <FONT SIZE="-1">PEM</FONT> file using <B><A HREF="/cgi-bin/man/man2html?3+PEM_read_bio_PUBKEY">PEM_read_bio_PUBKEY</A></B>(3) (or similar function).
<A NAME="lbAE">&nbsp;</A>
<H2>EXAMPLES</H2>
This example generates an <B>X25519</B> private key and writes it to standard
output in <FONT SIZE="-1">PEM</FONT> format:
<P>
<PRE>
#include &lt;<A HREF="file:///usr/include/openssl/evp.h">openssl/evp.h</A>&gt;
#include &lt;<A HREF="file:///usr/include/openssl/pem.h">openssl/pem.h</A>&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 <B><A HREF="/cgi-bin/man/man2html?3+EVP_PKEY_derive">EVP_PKEY_derive</A></B>(3) can be used with
<B>X25519</B> and <B>X448</B>.
<A NAME="lbAF">&nbsp;</A>
<H2>SEE ALSO</H2>
<B><A HREF="/cgi-bin/man/man2html?3+EVP_PKEY_CTX_new">EVP_PKEY_CTX_new</A></B>(3),
<B><A HREF="/cgi-bin/man/man2html?3+EVP_PKEY_keygen">EVP_PKEY_keygen</A></B>(3),
<B><A HREF="/cgi-bin/man/man2html?3+EVP_PKEY_derive">EVP_PKEY_derive</A></B>(3),
<B><A HREF="/cgi-bin/man/man2html?3+EVP_PKEY_derive_set_peer">EVP_PKEY_derive_set_peer</A></B>(3)
<A NAME="lbAG">&nbsp;</A>
<H2>COPYRIGHT</H2>
Copyright 2017-2020 The OpenSSL Project Authors. All Rights Reserved.
<P>
Licensed under the OpenSSL license (the ``License''). You may not use
this file except in compliance with the License. You can obtain a copy
in the file <FONT SIZE="-1">LICENSE</FONT> in the source distribution or at
&lt;<A HREF="https://www.openssl.org/source/license.html">https://www.openssl.org/source/license.html</A>&gt;.
<P>
<HR>
<A NAME="index">&nbsp;</A><H2>Index</H2>
<DL>
<DT id="1"><A HREF="#lbAB">NAME</A><DD>
<DT id="2"><A HREF="#lbAC">DESCRIPTION</A><DD>
<DT id="3"><A HREF="#lbAD">NOTES</A><DD>
<DT id="4"><A HREF="#lbAE">EXAMPLES</A><DD>
<DT id="5"><A HREF="#lbAF">SEE ALSO</A><DD>
<DT id="6"><A HREF="#lbAG">COPYRIGHT</A><DD>
</DL>
<HR>
This document was created by
<A HREF="/cgi-bin/man/man2html">man2html</A>,
using the manual pages.<BR>
Time: 00:06:10 GMT, March 31, 2021
</BODY>
</HTML>