The following encryption and decryption works fine in mysql (aes-256-cbc) mode
SET block_encryption_mode = 'aes-256-cbc';
select
cast(
aes_decrypt(
from_base64('StThdNXA+CWvlg+of/heJQ=='),
sha2(concat('ssshhhhhhhhhhh!!','ENCRYPTION_KEY$&'),256),
'ssshhhhhhhhhhh!!'
)
as char);
select to_base64(aes_encrypt(
'test_value',
sha2(concat('ssshhhhhhhhhhh!!','ENCRYPTION_KEY$&'),256),
'ssshhhhhhhhhhh!!'
));
I am trying to decrypt value that was encrypted in mysql but no luck.
The following is the key in my mysql query sha256(salt+key)
select sha2(concat('ssshhhhhhhhhhh!!','ENCRYPTION_KEY$&'),256);
The same value I am able to get in java :
Hashing.sha256().hashString("ssshhhhhhhhhhh!!ENCRYPTION_KEY$&", StandardCharsets.UTF_8).toString();
Is there a custom way I can make bouncy castle/other API use same secret key to decrypt ?