Lab Information
We have confidential data that needs to be transferred to a remote location, so we need to encrypt that data.We also need to decrypt data we received from a remote location in order to understand its content.
On storage server in Stratos Datacenter we have private and public keys stored at /home/*_key.asc. Use these keys to perform the following actions.
Encrypt /home/encrypt_me.txt to /home/encrypted_me.asc.
Decrypt /home/decrypt_me.asc to /home/decrypted_me.txt. (Passphrase for decryption and encryption is kodekloud).
The user ID you can use is kodekloud@kodekloud.com.
Lab Solutions
π§ Part 1: Lab Step-by-Step Guidelines
1οΈβ£ Login to Storage Server
ssh natasha@ststor01
# Password: Bl@kW
sudo -i
2οΈβ£ Import GPG keys
gpg --import /home/*_key.asc
# Password: kodekloud
3οΈβ£ Verify keys (optional but good practice)
gpg --list-keys
sudo chmod 777 /home
π You should see:
4οΈβ£ Encrypt the file
gpg --output /home/encrypted_me.asc \
--encrypt \
--recipient kodekloud@kodekloud.com \
/home/encrypt_me.txt
π Enter passphrase when asked:
kodekloud
5οΈβ£ Decrypt the file
gpg --output /home/decrypted_me.txt \
--decrypt /home/decrypt_me.asc
π Enter passphrase:
kodekloud
6οΈβ£ Verify output
cat /home/decrypted_me.txt
π§ Part 2: Simple Step-by-Step Explanation (Beginner Friendly)
What this lab is about
You are working with:
Encryption β hide data
Decryption β read data
Step 1: Import keys
gpg --import
π This loads:
Public key β used to encrypt
Private key β used to decrypt
Step 2: Encryption
gpg --encrypt
π What happens:
Plain file β converted into unreadable encrypted file
Only the person with the private key can open it.
Step 3: Decryption
gpg --decrypt
π What happens:
Encrypted file β converted back to readable content
Why passphrase is needed
Passphrase = protects the private key
Even if someone has the key file, they still need:
kodekloud
How keys work (simple idea)
Public key β lock π
Private key β unlock π
Final flow
encrypt_me.txt β encrypted_me.asc β (secure transfer)
decrypt_me.asc β decrypted_me.txt β readable
β‘ Key Takeaway
Encryption protects data during transfer
Decryption allows authorized access
Top comments (0)