Encrypts a message using the specified configuration.
The resulting
BigDecimal will have the same scale as the original one (although the
total number of bytes will be higher).
Important: The size of the result of encrypting a number, depending
on the algorithm, may be much bigger (in bytes) than the size of the
encrypted number itself. For example, encrypting a 4-byte integer can
result in an encrypted 16-byte number. This can lead the user into
problems if the encrypted values are to be stored and not enough room
has been provided.
The mechanisms applied to perform the encryption operation are described
in PKCS #5: Password-Based Cryptography Standard.
This encryptor uses a salt for each encryption
operation. The size of the salt depends on the algorithm
being used. This salt is used
for creating the encryption key and, if generated by a random generator,
it is also appended unencrypted at the beginning
of the results so that a decryption operation can be performed.
If a random salt generator is used, two encryption results for
the same message will always be different
(except in the case of random salt coincidence). This may enforce
security by difficulting brute force attacks on sets of data at a time
and forcing attackers to perform a brute force attack on each separate
piece of encrypted data.