How to decrypt a message using openssl’s CLI

command lineopenssl

I have a message, I know the password and the cipher that was used to encrypt it, but I can't figure out how to ask openssl to decrypt it.

I see the cipher in the output from the ciphers command, and the man page lists a enc command for Encoding with Ciphers, but I can't find how I would do the opposite, decode a message.

Best Answer

I think you're looking for something like this:

openssl yourcipher -d < yourfile

For example if the file was encrypted using des3 cipher, and the file is /path/to/file.des3 then:

openssl des3 -d < /path/to/file.des3

It will ask you for the passphrase.

If the file is base64 encoded, then you should be able decode and decrypt like this:

openssl enc -base64 -d < /path/to/file | openssl yourcipher -d
Related Question