The password based encryption algorithm used in openssl
changed from MD5 in version 1.0.2 (shipped with Ubuntu 16.04) to SHA256 in version 1.1.0 (Ubuntu 18.04). For that reason, any files encrypted on Ubuntu 16.04 fail to be decrypted on Ubuntu 18.04. The solution is to install the previous version of openssl
, decrypt the files and encryt them back again with the newer version. Step by step:
Start by downloading the older version of openssl
(this is the amd64 build, for other builds check packages.ubuntu.com):
wget http://security.ubuntu.com/ubuntu/pool/main/o/openssl/openssl_1.0.2g-1ubuntu13.6_amd64.deb
Now install the package directly with dpkg
, this will disable the newer version:
$ sudo dpkg -i openssl_1.0.2g-1ubuntu13.6_amd64.deb
Make sure you got the right version:
$ openssl version
OpenSSL 1.0.2g 1 Mar 2016 (Library: OpenSSL 1.0.2n 7 Dec 2017)
And now decrypt the file:
$ openssl des3 -d < secret.des3 > secret.txt
Then install the latest openssl build, apt
is an option:
$ sudo apt install openssl
Making sure it is the latest version:
$ openssl version
OpenSSL 1.1.0g 2 Nov 2017
And then encrypt the file again with the latest version:
$ openssl des3 < secret.txt > secret.des3
Finally remove the .deb
file downloaded in the begining:
$ rm openssl_1.0.2g-1ubuntu13.6_amd64.deb
-md
wasn't enough, I needed a fully downgraded version. – Mark Jan 12 '20 at 22:17