NAME
X25519
—
EVP_PKEY X25519 support
DESCRIPTION
The X25519
EVP_PKEY
implementation supports key generation and key derivation using X25519. It
has associated private and public key formats compatible with
draft-ietf-curdle-pkix-03.
No additional parameters can be set during key generation.
The peer public key must be set using EVP_PKEY_derive_set_peer(3) when performing key derivation.
A context for the X25519
algorithm can be
obtained by calling:
EVP_PKEY_CTX *pctx =
EVP_PKEY_CTX_new_id(NID_X25519, NULL);
EXAMPLES
Generate an X25519
private key and write
it to standard output in PEM format:
#include <openssl/evp.h> #include <openssl/pem.h> EVP_PKEY *pkey = NULL; EVP_PKEY_CTX *pctx = EVP_PKEY_CTX_new_id(NID_X25519, NULL); EVP_PKEY_keygen_init(pctx); EVP_PKEY_keygen(pctx, &pkey); EVP_PKEY_CTX_free(pctx); PEM_write_PrivateKey(stdout, pkey, NULL, NULL, 0, NULL, NULL);
The key derivation example in
EVP_PKEY_derive(3) can be used with
X25519
.