Many people already know how to use GPG/PGP to encrypt emails, messages and files with asymmetric public key encryption.
However there are times when symmetric (password) encryption may be a better option.
For this you can use gpg --symmetric
option. GPG includes the AES256 algorithm which is considered to be secure, as long as you set a secure password.
The encryption command is:
gpg -a --symmetric --cipher-algo AES256 my_file.txt
(-a
option encodes your encrypted file with ASCII armor so that it is easy to copy into a message or send as an attachment. These files have the file ending .asc
)
Enter the command, choose a password and your encrypted file will be saved to my_file.txt.asc
.
You can encrypt any files with this method, e.g. .txt, .doc, .zip.
To decrypt the file, enter:
gpg -a --output decrypted_file.txt --decrypt my_file.txt.asc
Then enter the password and your decrypted file will be saved to decrypted_file.txt
If you found this guide useful, feel free to send a contribution to 1CaLCR5mGwS4FJzU1HZm9qwr5WoRYFDdyB (BTC).
This article was written by Web4Crypto. Web4Crypto offers web development, web design, programming and scripting services from $40 and accepts Bitcoin, Monero, Ethereum and other cryptos. Visit https://web4crypto.xyz for more information and a free consultation.