'Decrypt with Java an encrypted word generated by OpenSsl

Inside Java code, I should decrypt a word encrypted as follows:

echo -n "secret" | openssl enc -aes-256-cbc -base64 -pass pass:password -md SHA1

I'm new to encryption, but I have found some sample how to encrypt/decrypt some AES/CBC with Java. But it requires Salt, Key and Iv. I have found that OpenSsl is deriving these values from the "password", but I don't have found how to do the same in Java in order to decrypt the encrypted value.

Does someone knows how it works ? Are the Salt, Key and/or Iv stored in the ecrypted value ? Thanks for your answers.



Solution 1:[1]

There are several libraries that support encryption and decryption that make it easy to implement in Java. I recommend you check out the BouncyCastle Lib. Here is a link Bouncy Castle Tutorial to a short tutorial.

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 hackbell