Posted By

gtcaz on 02/16/07


Tagged

password openssl encrypted


Versions (?)

Who likes this?

1 person have marked this snippet as a favorite

basicmagic


Cross platform secure password storage


 / Published in: Other
 

  1. A quicker method that also works cross-platform is to use OpenSSL (which macos includes).
  2.  
  3. To encypt a list of secrets with the 256-bit AES, open the terminal and do:
  4.  
  5. openssl enc -aes256 -salt -a -e -out secrets.aes
  6.  
  7. You'll then be prompted twice for a password, after which you can begin typing whatever you want. When you've typed enough, hit control-d twice and the data will be encrypted and placed in a filed named "secrets.aes".
  8.  
  9. To decrypt the file created above, do:
  10.  
  11. openssl enc -aes256 -a -d -in secrets.aes
  12.  
  13. Enter the password when asked and openssl will decrypt the file and print it in the terminal. Because openssl works the same under macos, bsd, linux, and (cygwin) Windows, files created like this can be used on any platform.
  14.  
  15. A slight variation can be used to encrypt/decrypt files (rather than typed input):
  16.  
  17. openssl enc -aes256 -salt -a -e -in myfile -out myfile.aes
  18. openssl enc -aes256 -salt -a -d -in myfile.aes -out myfile
  19.  
  20. There are also other cyphers available, type "openssl enc help" for a list.

Report this snippet  

You need to login to post a comment.