Encryption & Obfuscation
Encryption & Obfuscation
Sensitive values in config.yaml — client secrets, the obfuscation passphrase, and similar credentials — can be protected by using two independent mechanisms. Both are resolved before the application starts, so your code always receives plaintext.
| Mechanism | Prefix | Algorithm | Key material |
|---|---|---|---|
| Obfuscation | !obf <base64> | AES-256-CBC / PBKDF2-SHA512 | Shared passphrase (secrets.obf_key) |
| Encryption | !enc <base64> | RSA / PKCS#1-v1.5 | RSA private key (ENC_KEY env var) |
After you have your ciphertexts, place them in config.yaml and follow the deployment steps in the Installation Guide.
Obfuscation (!obf)
!obf)Requires OpenSSL 1.1.1 or later.
Step 1 — Choose a passphrase
Pick a strong, random passphrase (minimum 32 characters) and store it securely in a secrets manager. You need to supply it at runtime as secrets.obf_key in config.yaml.
my-strong-passphrase-32chars+
Never store the passphrase inconfig.yamlas plain text. Use!enc!obf,!secret, or!fileto inject it at runtime.
Step 2 — Obfuscate a secret value
Run the following command for each secret you want to obfuscate:
echo -n "<secret-value>" | openssl enc -aes256 \
-pbkdf2 -pass pass:"<obfuscation-passphrase>" -md sha512 \
-base64 | tr -d '\n'; echoExample:
echo -n "my-client-secret-value" | openssl enc -aes256 \
-pbkdf2 -pass pass:"my-strong-passphrase" -md sha512 \
-base64 | tr -d '\n'; echoExample Output:
U2FsdGVkX19iBh23scd53+QkybjO6RjFHhSbz4VRudYHA==Each run produces a different ciphertext because the encryption is salted, however, every ciphertext decrypts correctly with the same passphrase.
Step 3 — Place the ciphertext in config.yaml
config.yamlclient_secret: "!obf U2FsdGVkX19iBh23scd53+QkybjO6RjFHhSbz4VRudYHA=="Step 4 — Verify decryption of obfuscated value (optional)
echo "<base64-ciphertext>" | openssl enc -d -aes256 \
-pbkdf2 -pass pass:"<obfuscation-passphrase>" -md sha512 \
-base64; echoExpected output: the original plaintext secret.
Encryption (!enc)
!enc)Step 1 — Generate an RSA key pair
# Generate a 2048-bit RSA private key (4096-bit recommended for higher security)
openssl genrsa -out private.pem 2048
# Derive the public key
openssl rsa -in private.pem -pubout -out public.pemKeep
private.pemsecure. Store it in a safe location immediately after generating it — it is required to decrypt!encvalues at deployment time and cannot be recovered if lost.
Step 2 — Encrypt a secret value
Use the public key to encrypt each secret:
echo -n "<secret-value>" | openssl pkeyutl -encrypt \
-pubin -inkey public.pem \
-pkeyopt rsa_padding_mode:pkcs1 \
| base64 | tr -d '\n'; echoExample:
echo -n "my-client-secret-value" | openssl pkeyutl -encrypt \
-pubin -inkey public.pem \
-pkeyopt rsa_padding_mode:pkcs1 \
| base64 | tr -d '\n'; echoOutput (truncated):
QUORyJfiB3cQdlLQXDFQ6nC6btMq4e7llaniT2M1NaRKbnmR80Yy2ufAO8+mNGteGuDj7px2x71AtmvPNpkoF729PHGRjlAnE66qPXh4ypuLZYV2JQq39Ja/KgYUnO4=Run once per secret value.
Step 3 — Place the ciphertext in config.yaml
config.yamlclient_secret: "!enc QUORyJfiB3cQdlLQXDFQ6nC6btMq4e7llaniT2M1NaRKbnmR80Yy..."Step 4 — Verify decryption (optional)
echo -n "<base64-ciphertext>" | base64 -d | openssl pkeyutl -decrypt \
-inkey private.pem \
-pkeyopt rsa_padding_mode:pkcs1; echoExpected output: the original plaintext secret.
Next Steps
- Return to the Installation Guide to place your ciphertexts in
config.yamland configure the runtime key delivery (secrets.obf_key/ENC_KEY). - See Troubleshooting if the server fails to start after adding encrypted values.
Updated about 9 hours ago
