openssl genpkey
The OpenSSL subcommand that generates a new private key, such as an Ed25519 or RSA key, and writes it to a file.
In more detail
You choose the algorithm with -algorithm and the output file with -out, and options such as -pkeyopt set details like key size. The file it writes holds the private key, and the public key can be derived from it later with openssl pkey. Protect the output like any secret, or add a cipher option such as -aes256 to encrypt it with a passphrase.
Example
openssl genpkey -algorithm ed25519 -out alice.keyRelated terms
- OpenSSL — A widely used toolkit and library for cryptography and TLS, including the openssl command-line tool.
- openssl pkey — The OpenSSL subcommand that reads a key file to display it, convert its format or extract the public key from a private key.
- private key — The secret half of a key pair, which proves its holder's identity and must never be shared.
- Ed25519 — A modern public-key signature algorithm with small, fast keys, the recommended type for new SSH keys.
Taught in
- CIA Triad, Non-Repudiation & Parkerian Hexad — Cybersecurity Fundamentals, GRC & Cryptography