Wednesday, July 17, 2019

Encrypt and decrypt file between openssl 1.0.1 and 1.1.1

Encryption is done on sun10 with OpenSSL 1.0.1p, Decryption is don on Linux with OpenSSL 1.1.1c 
Generate Random Pass File
$ openssl rand -base 32 > ~/.ssh/passfile
Deliver the pass file to the client which will decrypt the encrypted file, and change the permission to 400
$ chmod 400 passfile
Encrypt File
$ openssl enc -aes-256-cbc -pass file:encryption/passfile -salt -in test.txt -out test.txt.aes

Decrypt File
openssl enc -d -aes-256-cbc -pass file:encryption/passfile -in test.txt.aes -out test.txt -md md5

No comments:

Post a Comment