Encrypt and decrypt files

From wikieduonline
Revision as of 11:58, 16 July 2020 by Welcome (talk | contribs)
Jump to navigation Jump to search

OpenSSL

Encrypt and decrypt a file[1] (GPG can also be used for encrypting and decrypting files)
Using aes-256-cbc cypher, You will be prompted for a password when encrypting that has to be used for decrypting.[2]

openssl enc -aes-256-cbc -in un_encrypted.data -out encrypted.data
You can use file command to verify file type.
file encrypted.data
encrypted.data: openssl enc'd data with salted password
Encrypt file providing password on the command line, be aware that your password will be store on history of your shell):
openssl aes-256-cbc -a -salt -in twitterpost.txt -out foo.enc -pass file:<( echo -n "someGoodPassword" )
openssl enc -d -aes-256-cbc -in encrypted.data -out un_encrypted.data


See also

  • https://unix.stackexchange.com/questions/162960/how-can-i-encrypt-a-file
  • https://stackoverflow.com/a/31552829
  • Advertising: