End-entity certificates identify VPN gateways and clients during IKEv2 authentication. Each certificate is signed by the CA and bound to a specific distinguished name and optional Subject Alternative Names (SANs).Documentation Index
Fetch the complete documentation index at: https://mintlify.com/strongswan/strongswan/llms.txt
Use this file to discover all available pages before exploring further.
Generate the host private key
Create a private key for the host or user. Ed25519 is recommended:Alternatively, generate a 3072-bit RSA key in binary DER format:
A TPM 2.0 Trusted Platform Module can store RSA or ECDSA keys in hardware, protecting them from extraction even if the OS is compromised. See the TPM 2.0 HOWTO for details.
Create a certificate signing request
Generate a PKCS#10 CSR containing the subject DN and SANs:The
--san option can be repeated to add multiple Subject Alternative Names. The value type is inferred automatically:Many IKEv2 implementations match peer identity against the SAN, not the CN. Always include the intended identity as a SAN.
Issue the signed certificate
Have the CA sign the CSR and produce an end-entity certificate:Key options:
Adding the TLS server authentication Extended Key Usage (EKU) — required by Windows, iOS, and macOS VPN clients for gateway certificates:Available
| Option | Description |
|---|---|
--cacert | CA certificate file |
--cakey | CA private key file |
--type pkcs10 | Input is a PKCS#10 CSR (use pub or priv for raw key input) |
--serial <hex> | Hexadecimal serial number; random if omitted |
--lifetime <days> | Certificate validity in days (1826 = 5 years) |
--flag values: serverAuth, clientAuth, ikeIntermediate, crlSign, ocspSigning, msSmartcardLogon.Adding CRL distribution points so peers can fetch revocation status dynamically:Inspect the issued certificate
Verify the certificate content before deploying it:Expected output:Confirm that
authkeyId matches the CA’s subjkeyId, that the SAN is present, and that any required EKU flags appear.Creating a PKCS#12 bundle for clients
Windows, macOS, Android, and iOS clients typically import credentials as a single PKCS#12 (.p12) file. The pki tool does not create PKCS#12 files directly; use openssl instead:
carolCert.p12 contains the user’s private key, certificate, and the CA certificate in a single password-protected file.
Credential file locations summary
| File | Directory | Mode |
|---|---|---|
| CA certificate | /etc/swanctl/x509ca/ | 644 |
| Host / user certificate | /etc/swanctl/x509/ | 644 |
| Private key | /etc/swanctl/private/ | 600 |
| PKCS#12 bundle | /etc/swanctl/pkcs12/ | 600 |