2013-06-11

OpenSSL File Encrypt / Decrypt

0. Confirm OpenSSL already setup. Otherwise visit http://www.openssl.org/
  which openssl

1. Check OpenSSL manual
  openssl --help

2. Encrypt
           Encrypt mode: aes256
             Input file: /TS.txt
            Output file: /TS.txt.enc
  Password provide mode: pass
               Password: 123456
  openssl enc -aes256 -in /TS.txt -out /TS.txt.enc -pass pass:123456

3. Decrypt
           Decrypt mode: aes256
             Input file: /TS.txt.enc
            Output file: /TS.dec.txt
  Password provide mode: pass
               Password: 123456
  openssl enc -d -aes256 -in /TS.txt.enc -out /TS.dec.txt -pass pass:123456

4. Using password file to encrypt / decrypt
  A.Generate password file
    echo "123456" > /SSL_File.pwd
 
  B.Encrypt by password file
    openssl enc -aes256 -in /TS.txt -out /TS.txt.enc -pass file:/SSL_File.pwd
 
  C.Decrypt by password file
    openssl enc -d -aes256 -in /TS.txt.enc -out /TS.dec.txt -pass file:/SSL_File.pwd

5. More reference website description under
  http://www.madboa.com/geek/openssl/

PS: This work in Linux Cent OS 6.2 and Windows 7

沒有留言: