Linux – Different results from GnuPG and OpenSSL when using AES256 encryption

encryptiongpglinuxopenssl

Text: apple
Pass: password

openssl aes-256-cbc -e -a -in  apple.txt

Output: U2FsdGVkX1/sqDrVkgk/7dKiCfLW+1/bgvRT/YAopJQ=

gpg -c --cipher-algo AES256 apple.txt

Output: A0ECQMCvDw3qeyQxgNg0kABv5nE4IDtSYmDTJudbl55d0GjBkiLd1B4sgbY/QQPVJX/uaHuDIb9
xhcwW/7UaxIxh9URhkHPni2IhYoOuKqm

How to sync out the two results?

Best Answer

The openssl command is salting your input and putting it in an OpenSSL encryption container. You could use the -nosalt option, but it will reduce the security of your encryption. I know less about the gpg command, but I'm pretty sure it's doing something similar. Its output is far too large to be just the word "apple" encrypted.

Related Topic