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