cancel
Showing results for 
Search instead for 
Did you mean: 

Generate same cipher text as result of encrypted value

Ajay_Chawda
Contributor

Hello Expert,
I’m trying to encrypt few fields of file (eg Name,Age) using encrypt field snap.
if same name and age appears in different file encrypt field snap is giving different cipher text.

Attaching sample pipeline for reference.

testCipherText_2021_08_17.slp (26.0 KB)

image

same content is present in all the files.

4 REPLIES 4

Ajay_Chawda
Contributor

Any suggestion?

ptaylor
Employee
Employee

You didn’t specify a value for the Initialization vector setting, so one is randomly generated for every field in every document. That’s why the cipher text is different. Note the documentation for this setting:

Leave empty to generate one automatically. Note that the content of the initialization vector should be different for every encryption operation. Reusing IVs will make the encryption operation less secure.

Ajay_Chawda
Contributor

Hi @ptaylor
Thank you for help.
it worked if provide key and Initialization vector details in snap it self.
but it did not worked if i consider key to be taken from account and Initialization vector information in snap it self.

below configuration worked
image

But if select account for key its not working.
image

The Passphrase-Based Key account generates a random seed every time it’s used, so the ciphertext will be different each time, even if the input, passphrase and IV haven’t changed.

If having consistent ciphertext is important to you, use a KeyStore account instead. You create a symmetric key and store it in a keystore file, then configure the account with that file plus a password and alias to access that key. Here’s an example of how to create a keystore ks.jks containing a 128-bit AES key with password mypassword and alias myalias:

keytool -genseckey -keyalg AES -keysize 128 -storepass mypassword -alias myalias -storetype JCEKS -keystore ks.jks