Lab 9
Chapter 17
🐧 Linux

File Encryption with GPG

Encrypt and decrypt files using symmetric and asymmetric GPG encryption.

0 / 7 tasks completed

📋 Tasks

1 Create a test file with sensitive data
echo 'CONFIDENTIAL: Server root password is S3cur3P@ss!' > secret.txt
2 Encrypt the file with symmetric encryption (AES-256)
gpg --symmetric --cipher-algo AES256 secret.txt
3 Verify the encrypted file was created
ls -la secret.txt*
4 Securely delete the original plaintext file
shred -vfz -n 3 secret.txt && rm secret.txt
5 Decrypt the file
gpg --decrypt secret.txt.gpg
6 Generate a GPG key pair for asymmetric encryption
gpg --gen-key
7 Export your public key for sharing
gpg --export --armor student@cyber-lab.local > public_key.asc

💻 Interactive Terminal

bash — cyber-lab
Welcome to Lab 9: File Encryption with GPG
Type commands below to complete each task. Type 'help' for available commands.
──────────────────────────────────────────────
student@cyber-lab:~$
💡 Complete task 1: Create a test file with sensitive data

🤔 Reflection

When would you use symmetric vs. asymmetric encryption?

← Lab 8 Lab 10 →