Handle small characters input
When the effective input data length for DPG APIs using FPE or Random2 algorithm is shorter than the minimum length specified by the algorithm's requirements, ciphertext or tokens cannot be generated according to the algorithm's specifications. In such cases, the admin can either choose to return the same value as the input or return an error, depending on the setting of the Allow Small Input parameter.
Effective input data length is the size of the input data that is actually processed by the algorithm.
If the Allow Small Input parameter is disabled and user attempts to protect a small input value, DPG doesn't process it and returns the Input buffer is too short (len=1), it has to be at least 2 bytes long error.
If the Allow Small Input parameter is enabled, DPG will process small input value as shown in the examples.
Note
Null or "" (empty) characters are always by passed, that is, the output is same as the input irrespective of any protection policy configurations.
To protect Luhn-compliant data, a minimum of 3 characters from the character set are required.
How to configure output for small input
When creating a protection policy on CipherTrust Manager, select the Allow Small Input checkbox. By default, this field is enabled.
Examples
The below examples demonstrate how DPG handles requests to protect/reveal small input using the following protection policy configurations.
Protection Policy Version: Internal
Prefix: CC-
Character Set: Alphanumeric
Allow Small Input: Enabled
Reveal Format: Plaintext
Protect Samples
Request for small input
curl --location 'http://<dpg host IP>:<dpg host port>/api/sample/resource/<resource>' --header 'Content-Type: application/json' --header 'Authorization: Basic cGxhaW50ZXh0VXNlcjo=' --data '{"number": 9}'
Response
{"number": "1001000CC-9"}
Request for null
curl --location 'http://<dpg host IP>:<dpg host port>/api/sample/resource/<resource>' --header 'Content-Type: application/json' --header 'Authorization: Basic cGxhaW50ZXh0VXNlcjo=' --data '{"number": null}'
Response
{"number": null}
Request for "" (empty)
curl --location 'http://<dpg host IP>:<dpg host port>/api/sample/resource/<resource>' --header 'Content-Type: application/json' --header 'Authorization: Basic cGxhaW50ZXh0VXNlcjo=' --data '{"number": ""}'
Response
{"number": ""}
Reveal Samples
Request for small input
curl --location 'http://<dpg host IP>:<dpg host port>/api/sample/resource/<resource>' --header 'Content-Type: application/json' --header 'Authorization: Basic cGxhaW50ZXh0VXNlcjo=' --data '{"number": 1001000CC-9}'
Response
{"number": "9"}
Request for null
curl --location 'http://<dpg host IP>:<dpg host port>/api/sample/resource/<resource>' --header 'Content-Type: application/json' --header 'Authorization: Basic cGxhaW50ZXh0VXNlcjo=' --data '{"number": null}'
Response
{"number": null}
Request for "" (empty)
curl --location 'http://<dpg host IP>:<dpg host port>/api/sample/resource/<resource>' --header 'Content-Type: application/json' --header 'Authorization: Basic cGxhaW50ZXh0VXNlcjo=' --data '{"number": ""}'
Response
{"number": ""}