The fields look harmless. But inside, the data is exposed. Field-level encryption in Keycloak changes that.
Keycloak offers identity and access management, but by default it does not encrypt individual fields in your application data. Field-level encryption ensures sensitive values—like social security numbers, medical records, or financial details—are encrypted individually before they hit storage. This means even with database access, attackers see only ciphertext.
Implementing this in Keycloak requires more than flipping a switch. You define encryption keys, manage lifecycle policies, and integrate the logic before persistence. In practice, you build a custom SPI (Service Provider Interface) within Keycloak to hook into the data processing pipeline. At write time, the SPI applies encryption using your chosen algorithm—AES-GCM is a common choice due to authenticated encryption. At read time, it securely fetches the keys and decrypts on demand.
Keys themselves must be protected. Storing them alongside the encrypted data defeats the purpose. Most teams integrate Keycloak with external KMS (Key Management Service) providers like AWS KMS or HashiCorp Vault. This allows rotation, revocation, and granular access control over who can request key material.