Client-side encryption
With client-side encryption (CSE), your client sends selected sensitive fields, such as the password, as ciphertext instead of plaintext. cidaas decrypts those fields before completing authentication, enrolment, or password operations.
Related: Pluggable Authentication Mechanism · Password Set · Enrollment · Authentication
Prerequisites
CSE applies to a request only if all three conditions are met:
| # | Condition | Where it is set |
|---|---|---|
| 1 | The tenant has the CSE feature (cse). | Provided by cidaas. With the feature, cidaas seeds the encryption key and the method configuration below. |
| 2 | The verification method has an encryptionConfig. | Seeded for PASSWORD, BACKUPCODE and PATTERN (see Method configuration). |
| 3 | The Verification Option of the application has encryptionEnabled: true. | Trust Desk: Verification Options → Enable encryption, or the Verification Options API. |
An application uses the Verification Option referenced in its authentication_setup.verification_options_id. If an application has no Verification Option, CSE is never applied for it. There is no fallback to the default option.
Before 4.1.0, CSE was switched on per verification method with encryptionConfig.enabled on PUT /verification-actions-srv/config. This field no longer exists and is ignored if you still send it. Existing settings are not migrated: if you used CSE before, set encryptionEnabled: true on the Verification Options of your applications.
Switch CSE on for an application
Set encryptionEnabled on the Verification Option that the application uses:
PUT /verification-actions-srv/verification-options/{id}
Authorization: Bearer <token with cidaas:verification_write>
Content-Type: application/json
{
"name": "web-apps",
"verification_options": {
"setting": "OFF",
"encryptionEnabled": true,
"allowed_methods": ["PASSWORD", "EMAIL"],
"use_default_password_policy": true
}
}
PUT replaces the whole verification_options object. If you omit encryptionEnabled, it is set to false and CSE is switched off for all applications using this option. The default value is false, also for the seeded default option.
Method configuration
The method settings define which fields may be encrypted and whether encryption is mandatory:
| Field | Values | Notes |
|---|---|---|
encryptionConfig.mode | OPTIONAL or REQUIRED (upper case) | OPTIONAL accepts plaintext or ciphertext for the listed fields. REQUIRED rejects plaintext for the listed fields with HTTP 400. |
encryptionConfig.encryptedFields | string array | Fields that may (or must) be sent encrypted. Set by cidaas; cannot be changed through the API. |
You can change mode with PUT /verification-actions-srv/config. Only methods that already have an encryptionConfig accept the change. Custom (pluggable) methods have no encryptionConfig and do not support CSE. A changed mode can take up to 15 minutes to take effect.
Defaults (seeded with the cse feature, mode OPTIONAL):
| Method | Encrypted fields |
|---|---|
PASSWORD | password, new_password, confirm_password, confirmPassword, password_echo, old_password |
BACKUPCODE | pass_code |
PATTERN | pass_code |
Where decryption runs
If CSE applies to the application, cidaas decrypts the listed fields on:
| Flow | Endpoint (family) |
|---|---|
| Authenticate / perform | …/verification-srv/authentication/{method}/verification |
| Finish enrolment | …/verification-actions-srv/setup/{method}/verification |
| Set password | POST /password-srv/password |
| Change password | PUT /password-srv/password |
| Accept password reset | POST /password-srv/resetpassword with action accept (or acceptreset) |
Password-reset initiate / validate code steps do not decrypt CSE payloads — only the accept step does.
Encrypting a field
Each listed field is encrypted on its own and sent as a string in compact JWE serialization. All other fields stay unchanged.
| Element | Requirement |
|---|---|
| Public key | The key with "use": "enc" from GET /.well-known/jwks.json of your cidaas instance (EC P-256). The key is only published when the tenant has the CSE feature. |
alg | ECDH-ES |
kid | The kid of the key used, in the JWE header |
iat | Current time (seconds) in the protected header. Accepted within ±60 seconds of the server time. |
jti | A unique ID per encrypted value in the protected header. A reused jti is rejected (replay protection). |
Errors:
| Situation | Response |
|---|---|
REQUIRED and a listed field is sent as plaintext | HTTP 400 |
Value is not a valid JWE, iat missing or outside the window, jti missing or reused | HTTP 400 |
Unknown kid or the value cannot be decrypted | HTTP 500 |
Integrator checklist
- Make sure the tenant has the CSE feature:
GET /.well-known/jwks.jsoncontains a key with"use": "enc". - Check that the application's Verification Option has
encryptionEnabled: true(GET /verification-actions-srv/verification-options/{id}, admin scope). - Read
modeandencryptedFieldsfor the methods of your application withGET /verification-actions-srv/config/{clientId}. - Encrypt only the fields named in
encryptedFields. UnderOPTIONALyou may still send plaintext, for example during development; underREQUIREDencrypt every listed field.
encryptionConfig on verification method settings is not yet exposed in the public OpenAPI for /verification-actions-srv/config. Use this guide as the source of truth until the OpenAPI paths are published.
For assistance, visit our Support Portal.