STRONGSWAN_PKI---SELF(1)
β¨ pki --self β¨
okay so bestie, welcome to PKI --SELF(1), the strongSwan glow-up edition of this page π this is the part of the pki(1) saga where we make a certificate sign itself. main character energy fr fr, no cap π
πΈ NAME πΈ
pki --self β create a self-signed certificate π
β¨ SYNOPSIS β¨
pki --self [--in file|--keyid hex] [--type t] --dn distinguished-name
[--san subjectAltName] [--lifetime days] [--not-
before datetime] [--not-after datetime] [--serial hex]
[--flag flag] [--digest digest] [--rsa-padding padding]
[--ca] [--ocsp uri] [--pathlen len] [--addrblock block]
[--nc-permitted name] [--nc-excluded name] [--critical oid]
[--policy-mapping mapping] [--policy-explicit len]
[--policy-inhibit len] [--policy-any len]
[--cert-policy oid [--cps-uri uri] [--user-notice text]]
[--outform encoding] [--debug level]
pki --self --options file
pki --self -h | --help
π DESCRIPTION π
This sub-command of pki(1) is the one that creates a self-signed certificate. that's the whole vibe. it's giving "i am my own authority" π₯
π¦ OPTIONS π¦
-h,--helpβ print usage info plus a lil summary of everything you can pass. your bestie when you forget a flag π-v,--debug levelβ set the debug level, default:1.-+,--options fileβ read command line options straight out offile. yes the short flag is literally a plus sign, iconic β-i,--in fileβ private key input file. if you don't give one, the key gets read fromSTDIN. ngl that's the "just pipe it, babe" option π«-x,--keyid hexβ smartcard or TPM private key object handle, in hex format, with an optional0xprefix. very hardware-girl π³-t,--type typeβ the type of the input key. eitherpriv,rsa,ecdsa,ed25519ored448, and it defaults topriv.-d,--dn distinguished-nameβ subject and issuer distinguished name (DN). Required. you literally cannot skip this one π«Ά-a,--san subjectAltNameβ subjectAltName extension to include in the cert. can be used multiple times, stack 'em up π-l,--lifetime daysβ how many days the certificate is valid, default:1095. ignored if both an absolute start and end time are given.-F,--not-before datetimeβ absolute time when the cert's validity begins. the datetime format is defined by the--dateformoption.-T,--not-after datetimeβ absolute time when the cert's validity ends. the datetime format is defined by the--dateformoption.-D,--dateform formβstrptime(3)format for the--not-beforeand--not-afteroptions, default:%d.%m.%y %T-s,--serial hexβ serial number in hex. it gets randomly allocated by default, so it's fine to just let it cook π²-e,--flag flagβ add an extendedKeyUsage flag. one ofserverAuth,clientAuth,crlSign, orocspSigning. can be used multiple times.-g,--digest digestβ digest to use when creating the signature. one ofmd5,sha1,sha224,sha256,sha384, orsha512. the default is determined based on the type and size of the signature key.-R,--rsa-padding paddingβ padding to use for RSA signatures. eitherpkcs1orpss, defaults topkcs1.-f,--outform encodingβ encoding of the created certificate file. eitherder(ASN.1 DER) orpem(Base64 PEM), defaults toder.-b,--caβ include the CA basicConstraint extension in the certificate. go off, authority figure π-o,--ocsp uriβ OCSP AuthorityInfoAccess URI to include in the certificate. can be used multiple times.-p,--pathlen lenβ set the path length constraint.-B,--addrblock blockβ RFC 3779 address block to include in the certificate.blockis either a CIDR subnet (such as10.0.0.0/8) or an arbitrary address range (192.168.1.7-192.168.1.13). can be repeated to include multiple blocks.
β οΈ bestie please read this bit: the supplied blocks are included in the certificate as is, so for standards compliance, multiple blocks must be supplied in correct order and adjacent blocks must be combined. refer to RFC 3779 for details. it does not tidy up after you π
-n,--nc-permitted nameβ add a permitted NameConstraint extension to the certificate. for DNS or email constraints, the identity type is not always detectable by the given name. use thedns:oremail:prefix to force a constraint type.-N,--nc-excluded nameβ add an excluded NameConstraint extension to the certificate. for DNS or email constraints, the identity type is not always detectable by the given name. use thedns:oremail:prefix to force a constraint type.-X,--critical oidβ add a critical extension with the given OID.-M,--policy-mapping issuer-oid:subject-oidβ add a policyMapping from issuer to subject OID.-E,--policy-explicit lenβ add a requireExplicitPolicy constraint.-H,--policy-inhibit lenβ add an inhibitPolicyMapping constraint.-A,--policy-any lenβ add an inhibitAnyPolicy constraint.
π Certificate Policy π
multiple certificatePolicy extensions can be added. each one comes with the following info:
-P,--cert-policy oidβ OID to include in the certificatePolicy extension. Required.-C,--cps-uri uriβ Certification Practice statement URI for certificatePolicy.-U,--user-notice textβ User notice for certificatePolicy.
π EXAMPLES π
generate a self-signed certificate using the given RSA key:
pki --self --in key.der --dn "C=CH, O=strongSwan, CN=moon" \
--san moon.strongswan.org > cert.der
see? one line (well, two, the backslash is doing heavy lifting πͺ) and you got a cert. slay.
π SEE ALSO π
and that's the whole page bestie, you ate it π go forth and self-sign responsibly.
later, legend β this was strongSwan version 6.0.7, dated 2019-05-06 π¦β¨
π¦ where this page comes from
- fedora 43: strongswan 6.0.7-2.fc43 Β· GPL-2.0-or-later
- fedora 44: strongswan 6.0.7-4.fc44 Β· GPL-2.0-or-later
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms