You want to send report.txt to your colleague Alice so that only she can read it, using GnuPG public key cryptography. Which key do you need, and which command uses it?
LPIC-1 Exam 102-500, objective 110. Security medium
Draft — not checked yet. This question was written from the published exam objectives and cites the clause it comes from, but nobody has yet read it against that clause and signed for it.
It is kept out of search results and out of mock exams until they have. Read the source below before you take the answer as settled.
The options
Not correct Your own private key, with `gpg --sign report.txt`
Wrong. Signing with your private key proves the file came from you and has not been altered, but the content is not concealed from anyone who obtains the file.
Not correct Your own public key, with `gpg --encrypt --recipient you@example.com report.txt`
Wrong. Encrypting to your own public key means only you can decrypt the result, since only you hold the matching private key. Alice would be unable to read it.
Not correct A passphrase you both agree on, with `gpg --symmetric report.txt`
Wrong for this question. --symmetric is a genuine gpg mode, but it is conventional shared-secret encryption: it uses no key pair at all and requires you to transmit the passphrase to Alice by some other secure channel.
Correct Alice's public key, with `gpg --encrypt --recipient alice@example.com report.txt`
Correct. You encrypt to the recipient's public key, which you must have imported into your keyring first, and only her matching private key can decrypt the result.
Why
Keep the two directions apart. To encrypt for someone, use their public key; they decrypt with their private key. To sign, use your private key; anyone verifies with your public key. `gpg --encrypt --sign --recipient alice@example.com report.txt` does both, producing a file only Alice can read and that she can confirm came from you. Add --armor to get printable ASCII output suitable for email instead of the default binary. You obtain Alice's key with `gpg --import alice.asc` or from a key server with `gpg --keyserver <server> --recv-keys <keyid>`.
Where this comes from
- Cited
- LPI exam objective 110.3
- What it says
- Encrypt and sign files with GnuPG using the correct key of the pair.
Practise this
Reading one question is not practice. The trainer will draw a set from objective 110 and space the ones you get wrong.