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_
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 -inReplace _your_password_ with the secret
Outputs to stdout
See the full demo attached here for a blow by blow:
Reference
Technorati Tags: openssl, encryption, tripleDES, passwords

