Hack Forums
Encrypt and Decrypt files with gpg 4096 bits - Printable Version

+- Hack Forums (https://hackforums.net)
+-- Forum: Hacks, Exploits, and Various Discussions (https://hackforums.net/forumdisplay.php?fid=45)
+--- Forum: Blackhat • Red Team • Offensive Security (https://hackforums.net/forumdisplay.php?fid=447)
+---- Forum: Cryptography, Encryption, and Decryption (https://hackforums.net/forumdisplay.php?fid=126)
+---- Thread: Encrypt and Decrypt files with gpg 4096 bits (/showthread.php?tid=5559731)



Encrypt and Decrypt files with gpg 4096 bits - ElmagoLoko - Feb 24, 2017

Generate a RSA Key:
Code
gpg --gen-key

To encrypt a file

Code
gpg -c file.to.encrypt
To decrypt a file

Code
gpg file.to.encrypt.gpg

But gpg will not do entire directories. For entire directories you have several options, ecryptfs is popular.

# Install if ecryptfs-utils if needed]
Code
sudo apt-get install ecryptfs-utils

Make an encrypted directory
Code
ecryptfs-setup-private
That will make a directory "Private". Any data you put into the directory Private will automatically be encrypted when you log out and decrypted when you log in.

If you want a different behavior or a different directory ...

Code
mkdir ~/secret
Code
chmod 700 ~/secret

Code
sudo mount -t ecryptfs ~your_user/secret ~your_user/secret
Put your data into ~/secrte

To encrypt

Code
sudo umount ~your_user/secret
To Decrypt

Code
sudo mount ./secret ./secret -o key=passphrase,ecryptfs_cipher=aes,ecryptfs_key_bytes=16,ecryptfs_passthrough=no,ecryptfs_enable_filename_crypto=yes



* - RastaManKing - Feb 24, 2017

Good information on here.. thank you man..