top of page
COURSE 1 - 3.3.2.2. Encrypt text (Terminal)
QUICK INFO:
Asymmetric encryption: key pair (Private, Public): the recipient sends his Public key to the sender
Command to import a Public Key:
gpg --import KEY_FILE
Command to encrypt some text for a recipient (output on screen):
echo "TEXT TO ENCRYPT" | gpg --sign --local-user KEY_ID --encrypt --armor --recipient EMAIL_OF_RECIPIENT --recipient SENDER_EMAIL
Command to encrypt some text for a recipient (output on file):
echo "TEXT TO ENCRYPT" | gpg --sign --local-user KEY_ID --encrypt --armor --recipient EMAIL_OF_RECIPIENT --recipient SENDER_EMAIL > FILE_NAME.txt.asc
Command to read the encrypted file on screen:
cat FILE_NAME.txt.asc
To decrypt a text encrypted with our Public Key:
paste the encrypted, armored text into a file
save the file as .asc: e.g. "FILE_NAME.txt.asc
gpg --decrypt FILE_NAME.txt.asc > FILE_NAME.txt
Command to read the decrypted file on screen:
cat FILE_NAME.txt
How to encrypt/decrypt some text using the Linux command line (Tails' Terminal):
bottom of page