LinuxCommandLibrary
GitHubF-DroidGoogle Play Store

openssl-genpkey

generates private keys for various algorithms

TLDR

Generate RSA private key
$ openssl genpkey -algorithm RSA -out [private.key] -pkeyopt rsa_keygen_bits:[4096]
copy
Generate EC private key
$ openssl genpkey -algorithm EC -out [private.key] -pkeyopt ec_paramgen_curve:[P-256]
copy
Generate Ed25519 key
$ openssl genpkey -algorithm ED25519 -out [private.key]
copy
Generate encrypted private key
$ openssl genpkey -algorithm RSA -out [private.key] -aes256
copy
Generate with custom parameters
$ openssl genpkey -algorithm RSA -out [key.pem] -pkeyopt rsa_keygen_bits:2048 -pkeyopt rsa_keygen_pubexp:65537
copy

SYNOPSIS

openssl genpkey [options]

DESCRIPTION

openssl genpkey generates private keys for various algorithms. It's the modern replacement for algorithm-specific commands like genrsa and ecparam.Supports RSA, EC, ED25519, ED448, X25519, X448, and more.

PARAMETERS

-algorithm alg

Key algorithm.
-out file
Output file.
-outform format
Output format (PEM, DER).
-aes256, -aes128
Encrypt output.
-pkeyopt opt:val
Algorithm options.
-pass arg
Output passphrase.

ALGORITHM OPTIONS

$ RSA: rsa_keygen_bits, rsa_keygen_pubexp
EC:  ec_paramgen_curve (P-256, P-384, secp256k1)
copy

INSTALL

sudo apt install openssl
copy
sudo dnf install openssl
copy
sudo pacman -S openssl
copy
sudo apk add openssl
copy
sudo zypper install openssl
copy
brew install openssl
copy
nix profile install nixpkgs#openssl
copy

CAVEATS

Protect generated private keys. Use strong encryption for storage. ED25519 recommended for new applications.

HISTORY

genpkey was introduced as a unified key generation command, replacing older algorithm-specific commands in OpenSSL.

SEE ALSO

Braincup
Open source brain training for math, memory and focus
Braincup mini-games
41 mini-games · Apache-2.0
No ads · No tracking
Play in browser
Download Braincup on the App StoreGet Braincup on Google PlayGet Braincup on F-Droid
276 stars
From the maker of Linux Command Library
Copied to clipboard
Braincup
Open source brain training for math, memory and focus. 41 mini-games, from mental arithmetic to Sudoku, N-Back and Solo Chess.
Apache-2.0 licensed · No ads · No tracking · No account
From the maker of Linux Command Library
Download Braincup on the App StoreGet Braincup on Google PlayGet Braincup on F-Droid