User Tools

Site Tools


howtos:file_encryption_with_openssl

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

howtos:file_encryption_with_openssl [d/m/Y H:i] (current)
Line 1: Line 1:
 +Encrypt file:
  
 +<code>
 +$ openssl aes-256-cbc -salt -in file-test -out file-test.aes
 +enter aes-256-cbc encryption password:
 +Verifying - enter aes-256-cbc encryption password:
 +</code>
 +
 +Decrypt file:
 +
 +<code>
 +$ openssl aes-256-cbc -d -in file-test.aes -out file-test-dec
 +</code>
 +
 +Encrypt file and convert it to Base64:
 +
 +<code>
 +$ openssl aes-256-cbc -a -salt -in file-test -out file-test-64
 +</code>
 +
 +And this way to decrypt it:
 +
 +<code>
 +$ openssl aes-256-cbc -d -a -in file-test-64 -out file-64.dec
 +</code>
 +
 +Append password onto the encrypt command:
 +
 +<code>
 +$ openssl aes-256-cbc -a -salt -in file-test -out file-test-64 -k password
 +</code>
 +
 +Encrypt one-liner with password from a file:
 +
 +<code>
 +$ for f in * ; do [ -f $f ] && openssl aes-256-cbc -salt -in $f -out $f.enc -pass file:password.txt ; done
 +</code>
 +
 +Encrypt one-liner with password in commandline:
 +
 +<code>
 +$ password="password123";for f in * ; do [ -f $f ] && openssl aes-256-cbc -salt -in $f -out $f.enc -k $password ; done
 +</code>
 +
 +Hashes:
 +
 +<code>
 +$ openssl sha1 file-test-64
 +SHA1(eapol-64)= afc594f26ca0878073769d24f8c04fe35f2bf8b3
 +</code>
 +
 +Hash of files in current directory:
 +
 +<code>
 +$ ls * | xargs openssl sha1
 +</code>
 +
 +Replace "sha1" with "md5" if you need the md5 hash instead.
 +
 +
 +----
 +Source: http://olex.openlogic.com/wazi/2011/more-slick-openssl-tricks/
howtos/file_encryption_with_openssl.txt · Last modified: d/m/Y H:i (external edit)