Reputation: 128
I am trying to encrypt few database columns (string values) using Java AES algorithm. This is to protect certain sensitive data. For some users these data should decrypted.
In Java AES encryption, if my input character length is 60, I am getting encrypted string length as 88.
But I don't want a change the length of the encrypted data. We have huge amount to tables and many applications are using those tables. We want to minimize the impact of encrypting certain fields in the tables.
Is there is any recommended solution? OR is there is any recommended algorithm, code sample, etc?
Upvotes: 2
Views: 723
Reputation: 43788
In such situation you can use a stream cipher instead of a block cipher. Note that block ciphers can also be used as stream ciphers, for example the AES in counter mode.
If you have to use a block cipher and all your fields are larger than one block you can use cipher text stealing.
Both methods give you an output that has the same length as the input when regarded as byte array. There may be difficulties to represent the output byte array as a string in the same length as the input.
Upvotes: 1