Skip to main content
To deploy Keycloak in FIPS mode, you need a FIPS-approved keystore. In this tutorial we will use the Bouncy Castle FIPS KeyStore (termed BCFKS). A BCFKS keystore is a Java KeyStore (JKS) format provided by Bouncy Castle that is specifically designed for FIPS-compliant cryptography. The following guide involves the following components:

Prerequisites

  • Docker available locally
  • Token to pull images from the Minimus image registry
  • A working directory for keystores and certs

Deploy Keycloak for production

The following explains how to deploy Keycloak in either HTTPS mode or HTTP-dev mode.
1

Create a BCFKS Keystore (FIPS‑approved)

Use keytool from the Keycloak FIPS image to generate a BCFKS keystore and keypair (provider CCJ):
Create BCFKS keystore
If you encounter a permissions-related error, grant write permissions to your working directory and rerun the above command:
Verify the BCFKS keystore:
2

Generate a Local CA and Server Certificate (PEM)

To set up HTTPS using PEM files (instead of a keystore), follow the steps to create a local CA and sign a server certificate.
  1. Generate a private key for the Certificate Authority (CA):
  2. Create a root self-signed CA certificate:
  3. Generate a Server RSA private key for Keycloak:
  4. CSR for your Keycloak host (edit CN):
  5. Create a file keycloak.ext containing certificate extension settings for a TLS certificate:
  6. Sign a Certificate Signing Request (CSR) with your CA:
  1. Run ls to verify that the following certificates were created:
    • CA: myCA.crt, myCA.key, myCA.srl
    • Server (PEM): keycloak.crt, keycloak.key, keycloak.csr, keycloak.ext
3

Create a BCFKS Truststore (to trust your CA)

Import your CA into a BCFKS truststore:
Import CA into truststore
4

Run Keycloak

To run in dev mode, deploy Keycloak in HTTP:
Run Keycloak in HTTP
Visit the Keycloak console (UI) at http://localhost:8080.
Even in HTTP mode, FIPS checks still apply to admin and other passwords so ensure they have at least 14 characters.
To run in production, deploy Keycloak with the truststore in HTTPS:
Run Keycloak in HTTPS
Visit the Keycloak console (UI) in HTTPS at https://localhost:8443.
5

Trust the CA locally (browser/curl)

6

File hygiene

Change the file permissions in server.keystore so only the file owner has read/write access and nobody else has access:

Troubleshooting

If you get an error password must be at least 112 bits, it means that one or more passwords is under 14 characters long. Passwords should be 16-24 characters. Check the passwords for the following variables: KC_BOOTSTRAP_ADMIN_PASSWORD, KC_HTTPS_KEY_STORE_PASSWORD, truststore password, etc.
Last modified on May 20, 2026