OpenSSL with one base64 string. input file error

I have an AES-encrypted file that is encoded in base64 single line (no breaks) and needs to be decrypted. Here he is.

But when I use:

openssl enc -d -a -aes-256-cbc -in encrypted -out decrypted 

OpenSSL throws "input file for reading errors"
But base64 util decodes it like a charm:

 base64 -d encrypted | openssl enc -d -aes-256-cbc > decrypted 

Trying to find the cause and convert to a single-line base64 file:

 base64 -w 0 aesfile | openssl enc -d -a -aes-256-cbc > decrypted # error reading input file base64 aesfile | openssl enc -d -a -aes-256-cbc > decrypted # no errors, file decrypted 

Conclusion: OpenSSL cannot decode base64 non-multi-line inputs

+7
multiline base64 openssl encryption line-breaks
source share
1 answer

Encrypt

 openssl enc -aes-256-cbc -pass pass:YOURPASSWORD -p -in msg.txt -out enc.txt -base64 

Decrypt

 openssl enc -aes-256-cbc -base64 -pass pass:YOURPASSWORD -d -p -in enc.txt -out dec.txt 

If there is no newline in the encrypted file after the base64 line, you will receive the error message error reading input file .

+5
source share

All Articles