Package formflow.library.data
Class SubmissionEncryptionService
java.lang.Object
formflow.library.data.SubmissionEncryptionService
Service providing encryption and decryption of designated fields in a
Submission using Google's
Tink Cryptographic Library-
Field Summary
FieldsModifier and TypeFieldDescriptionfinal StringSuffix added to the field name for encrypted fields -
Constructor Summary
ConstructorsConstructorDescriptionSubmissionEncryptionService(String key, String inputConfigPath) Constructs an instance of theSubmissionEncryptionService -
Method Summary
Modifier and TypeMethodDescriptiondecrypt(Submission submission) Goes through "@Encrypted" annotations and replaces the encrypted fields with the decrypted value.encrypt(Submission submission) Go through "@Encrypt" annotations and replace fields with encrypted value.
-
Field Details
-
ENCRYPT_SUFFIX
Suffix added to the field name for encrypted fields- See Also:
-
-
Constructor Details
-
SubmissionEncryptionService
public SubmissionEncryptionService(@Value("${form-flow.encryption-key:#{null}}") String key, @Value("${form-flow.inputs: \'formflow.library.inputs.\'}") String inputConfigPath) Constructs an instance of theSubmissionEncryptionService- Parameters:
key- the key used to encrypt the fieldsinputConfigPath- the package path where inputs classes are located
-
-
Method Details
-
encrypt
Go through "@Encrypt" annotations and replace fields with encrypted value.Ex.
Given:{secret: "this is a secret"}
Result:{secret_encrypted: "some-encrypted-chars"}- Parameters:
submission- submission to be encrypted- Returns:
- encrypted copy of the given submission
-
decrypt
Goes through "@Encrypted" annotations and replaces the encrypted fields with the decrypted value.Ex.
Given:{secret_encrypted: "some-encrypted-chars"}
Result:{secret: "this is a secret"}- Parameters:
submission- submission to be decrypted- Returns:
- decrypted copy of the given submission
-