A Certificate Authority (CA) is the trust anchor for your VPN. Every gateway and client certificate you issue will be signed by it, and every peer will verify its certificate against the CA certificate. This page walks through creating a minimal, self-contained root CA usingDocumentation 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.
pki.
Generate the CA private key
Create an Ed25519 private key (recommended):Alternatively, generate a 3072-bit RSA key:Key size guidance for RSA:
Ed25519 produces compact 256-bit keys with 128-bit security and is supported by all modern IKEv2 implementations. RSA is more widely compatible with legacy systems.
| Size | Security level | Recommended use |
|---|---|---|
| 2048 bits | ~112-bit | Legacy / interop only |
| 3072 bits | ~128-bit | Current standard |
| 4096 bits | ~140-bit | High-security environments |
Create the self-signed CA certificate
Use Key options:
pki --self to wrap the public key in a self-signed X.509 CA certificate with a 10-year lifetime (3652 days):| Option | Description |
|---|---|
--ca | Set the CA basic constraint and keyCertSign / CRLSign key usages |
--lifetime <days> | Validity period in days (default: 1095) |
--dn <distinguished name> | Subject DN in RFC 4514 format |
--outform pem | Output as Base64 PEM instead of binary DER |
Inspect the CA certificate
Verify the generated certificate:Expected output:Confirm that
flags includes CA and CRLSign, and that issuer equals subject (self-signed).Store and distribute the CA files
| File | Where it goes | Who needs it |
|---|---|---|
strongswanKey.pem | Secure offline storage (not on any VPN gateway) | CA operator only |
strongswanCert.pem | /etc/swanctl/x509ca/ on every VPN endpoint | All gateways and clients |
Intermediate CAs
For larger deployments, issue an intermediate CA certificate instead of signing end-entity certificates directly from the root. This limits exposure of the root key. First issue an intermediate CA cert from your root CA:--ca flag on pki --issue sets the CA:TRUE basic constraint, making the issued certificate capable of signing further certificates.
Place both the intermediate certificate and the root CA certificate in
/etc/swanctl/x509ca/. strongSwan will automatically build the chain.