STRONGSWAN_PKI---SELF(1)

πŸ“¦
version 6.0.7 Β· 4 versions
, in fedora 43, fedora 44

✨ 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 of file. 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 from STDIN. ngl that's the "just pipe it, babe" option πŸ’«
  • -x, --keyid hex β€” smartcard or TPM private key object handle, in hex format, with an optional 0x prefix. very hardware-girl πŸ’³
  • -t, --type type β€” the type of the input key. either priv, rsa, ecdsa, ed25519 or ed448, and it defaults to priv.
  • -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 --dateform option.
  • -T, --not-after datetime β€” absolute time when the cert's validity ends. the datetime format is defined by the --dateform option.
  • -D, --dateform form β€” strptime(3) format for the --not-before and --not-after options, 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 of serverAuth, clientAuth, crlSign, or ocspSigning. can be used multiple times.
  • -g, --digest digest β€” digest to use when creating the signature. one of md5, sha1, sha224, sha256, sha384, or sha512. the default is determined based on the type and size of the signature key.
  • -R, --rsa-padding padding β€” padding to use for RSA signatures. either pkcs1 or pss, defaults to pkcs1.
  • -f, --outform encoding β€” encoding of the created certificate file. either der (ASN.1 DER) or pem (Base64 PEM), defaults to der.
  • -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. block is either a CIDR subnet (such as 10.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 the dns: or email: 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 the dns: or email: 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 πŸ’œ

pki(1)


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