Encrypt TripleDES

Problem

You want to encrypt some text, using the tripleDES Cipher.



Solution

Openssl is a beautiful command, that performs many functions. See example.



Example


Openssl tripleDES encrypt command:
openssl des3 -salt -in file_to_encrypt -pass pass:_your_password_

Security

Place contents to encrypt in the file reference by file_to_encrypt

Replace your_password with your secret

Openssl will output to stdout – so best to capture like this:
myvar=$(the openssl command)
Openssl tripleDES decrypt command:
openssl des3 -d -salt -in file_to_encrypt -pass pass:_your_password_
Put cipher text to decrypt in filename supplied to -in

Replace _your_password_ with the secret

Outputs to stdout
See the full demo attached here for a blow by blow:

[ How to encrypt with openssl and tripleDES ]



Reference

[tags]openssl, encryption, tripleDES, passwords[/tags]



Leave a Reply

Your email address will not be published. Required fields are marked *