PKI---GEN(1)
π PKI --GEN(1) π
okay so bestie, welcome to the pki --gen page β it's the key-generating sub-command from strongSwan, and it lives in the manual as PKI --GEN(1). it's genuinely iconic, let me walk you through it π
β¨ NAME β¨
pki --gen β generate a new RSA or ECDSA private key π
πΈ SYNOPSIS πΈ
pki --gen [--type type] [--size bits] [--safe-primes] [--shares n]
[--threshold l] [--outform encoding] [--debug level]
pki --gen --options file
pki --gen -h | --help
π¦ DESCRIPTION π¦
so this is a sub-command of pki(1), right, and its whole personality is generating a brand-new RSA or ECDSA private key. that's it, that's the gig. no cap π
β¨ OPTIONS β¨
-h,--helpβ prints the usage info plus a lil summary of everything you can pass. your bestie when you're lost π«Ά-v,--debug levelβ sets the debug level. default is1, slay β¨-+,--options fileβ reads the command line options straight out of a file. lowkey convenient.-t,--type typeβ the type of key you wanna generate: eitherrsa,ecdsa,ed25519, ored448. defaults torsaπ-s,--size bitsβ key length in bits. defaults to2048forrsaand384forecdsa. and heads up: forecdsaonly three values work rn β256,384and521. that's the whole menu, fr fr.-p,--safe-primesβ generates RSA safe primes.-f,--outform encodingβ the encoding of the private key you just made: eitherder(ASN.1 DER) orpem(Base64 PEM). defaults toderπ
π₯ RSA Threshold Cryptography π₯
-n,--shares <n>β number of private RSA key shares.-l,--threshold <l>β minimum number of participating RSA key shares.
β PROBLEMS ON HOSTS WITH LOW ENTROPY β
bestie, listen, this part matters π if the gmp plugin is the one generating your RSA private keys, the key material gets read from /dev/random (via the random plugin). which meansβyupβthe command can literally just block if the system's entropy pool is empty. very much giving loading screen forever π
to dodge that, you've got options:
- use a hardware random number generator to feed
/dev/random, or - use OpenSSL (via the
opensslplugin or the command line) β it's not as strict about the quality of the key material (it reads from/dev/urandomif necessary).
you can also configure the devices the random plugin uses in strongswan.conf(5). setting libstrongswan.plugins.random.random to /dev/urandom forces the plugin to treat bytes read from /dev/urandom as high grade random data, which avoids the blocking β¨ but of course, it doesn't change the fact that key material generated this way is of lower quality. keeping it real π«Ά
tl;dr: skipping the block means lower-quality randomness. no free lunch, bestie.
π EXAMPLES π
pki --gen --size 3072 > rsa_key.der
generates a 3072-bit RSA private key π
pki --gen --type ecdsa --size 256 > ecdsa_key.der
generates a 256-bit ECDSA private key π
πΈ SEE ALSO πΈ
pki(1) β go read it, iykyk π
okay that's the whole page, mwah π this was strongSwan version 6.1.0, dated 2016-12-13 β iconic behavior, go generate some keys bestie ππ¦β¨
π¦ where this page comes from
- arch rolling: strongswan 6.1.0-2 Β· GPL-2.0-only
- nixos 26.05: strongswan 6.1.0
- nixpkgs unstable: strongswan 6.1.0
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash-1017 on : a language model's rewrite of the original, under its terms