A single misconfigured certificate can break your Keycloak deployment. Openssl is the tool that keeps your realm secure and your connections trusted. When you need to generate, inspect, or convert certificates for Keycloak, Openssl is the fastest path with the most control.
Keycloak supports TLS for securing communication between clients, admin consoles, and identity provider endpoints. To enable TLS, you need a keystore with a valid private key and certificate chain. Openssl lets you create these artifacts with precision.
Generate a private key and certificate
openssl genrsa -out keycloak.key 2048
openssl req -new -key keycloak.key -out keycloak.csr
openssl x509 -req -in keycloak.csr -signkey keycloak.key -out keycloak.crt -days 365
This creates a 2048-bit RSA key, a CSR, and a self-signed certificate. Replace -signkey with your CA-signed certificate to avoid browser warnings.
Convert to PKCS12 format for Keycloak
Keycloak often uses .p12 or .jks formats for keystores. Openssl can convert your PEM files: