Skip to main content
Version: 4.1.0

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:

#ConditionWhere it is set
1The tenant has the CSE feature (cse).Provided by cidaas. With the feature, cidaas seeds the encryption key and the method configuration below.
2The verification method has an encryptionConfig.Seeded for PASSWORD, BACKUPCODE and PATTERN (see Method configuration).
3The 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.

Changed in 4.1.0

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:

FieldValuesNotes
encryptionConfig.modeOPTIONAL or REQUIRED (upper case)OPTIONAL accepts plaintext or ciphertext for the listed fields. REQUIRED rejects plaintext for the listed fields with HTTP 400.
encryptionConfig.encryptedFieldsstring arrayFields 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):

MethodEncrypted fields
PASSWORDpassword, new_password, confirm_password, confirmPassword, password_echo, old_password
BACKUPCODEpass_code
PATTERNpass_code

Where decryption runs​

If CSE applies to the application, cidaas decrypts the listed fields on:

FlowEndpoint (family)
Authenticate / perform…/verification-srv/authentication/{method}/verification
Finish enrolment…/verification-actions-srv/setup/{method}/verification
Set passwordPOST /password-srv/password
Change passwordPUT /password-srv/password
Accept password resetPOST /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.

ElementRequirement
Public keyThe 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.
algECDH-ES
kidThe kid of the key used, in the JWE header
iatCurrent time (seconds) in the protected header. Accepted within ±60 seconds of the server time.
jtiA unique ID per encrypted value in the protected header. A reused jti is rejected (replay protection).

Errors:

SituationResponse
REQUIRED and a listed field is sent as plaintextHTTP 400
Value is not a valid JWE, iat missing or outside the window, jti missing or reusedHTTP 400
Unknown kid or the value cannot be decryptedHTTP 500

Integrator checklist​

  1. Make sure the tenant has the CSE feature: GET /.well-known/jwks.json contains a key with "use": "enc".
  2. Check that the application's Verification Option has encryptionEnabled: true (GET /verification-actions-srv/verification-options/{id}, admin scope).
  3. Read mode and encryptedFields for the methods of your application with GET /verification-actions-srv/config/{clientId}.
  4. Encrypt only the fields named in encryptedFields. Under OPTIONAL you may still send plaintext, for example during development; under REQUIRED encrypt every listed field.
OpenAPI

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.

info
Need Support?

For assistance, visit our Support Portal.