Skip to main content

Overview

Encryption keys let you encrypt sensitive fields in logs and sessions before they reach Formal’s servers. You decrypt them on demand from your browser. Encrypted fields are stored as JWE (JSON Web Encryption) instead of plaintext. Refer to the log schemas documentation to learn which fields can be encrypted.
Log encryption keys are separate from Token Encryption. Use token encryption (and the HTTP encrypt / decrypt policy actions) to seal OAuth tokens in the data path. See Encrypt MCP OAuth Tokens.

Configuration via Terraform

Encryption keys are managed through the formal_encryption_key resource. AWS KMS, GCP KMS, and Azure Key Vault are supported, all using an asymmetric RSA key. The encrypting client (Connector or Formal Endpoint) holds only the public key and needs no cloud credentials, so only the decryptor can recover the plaintext.
The region is derived from the key ARN, so pass the full ARN in key_id.
Symmetric and deterministic algorithms (aes_random, aes_deterministic) are deprecated and can no longer be registered. Encryption keys use asymmetric RSA (rsaes_oaep_sha256), which both the Connector and Formal Endpoint can use without cloud credentials.

The Decryptor

Formal cannot decrypt these fields. When you set a decryptor_uri, the client-side JavaScript of the Control Plane calls it when a user decrypts a field. The endpoint must support CORS and accept POST requests with the encrypted payload in the body. Use this decryptor reference implementation, which unwraps AWS KMS, GCP KMS, and Azure Key Vault keys and ships Terraform examples for Lambda, Cloud Run, and Container Apps.

Password protection

The reference decryptor can require a shared password on every decrypt request. Set DECRYPTOR_PASSWORD_SHA256 to the hex-encoded SHA-256 of the password, not the password itself:
The Terraform examples expose this as the decryptor_password_sha256 variable. The first time a decrypt is rejected, the Control Plane asks the user for the password. It then sends the password in the X-Decryptor-Password header and keeps it in memory for the rest of the browser session. If you put your own CORS layer or proxy in front of the decryptor, allow that header. Without the variable, anyone who can reach the endpoint can decrypt.
The password is shared by every user, not tied to individual users. Deploy the decryptor behind a VPN or in a private network as well.