Encrypt report.txt with the OpenPGP public key of alice@example.test and create report.txt.gpg.
Do not sign it with your own private key.
Which command is appropriate?
gpg --encrypt --recipient RECIPIENT FILE uses the recipient's public key for confidentiality; the matching private key is needed to decrypt.
Detailed explanation
gpg --output report.txt.gpg --encrypt --recipient alice@example.test report.txtCorrect. It encrypts the file for alice@example.test.
Correct. It encrypts the file for alice@example.test.
gpg --output report.txt.gpg --decrypt report.txtIncorrect. --decrypt is the opposite operation.
Incorrect. --decrypt is the opposite operation.
gpg --output report.txt.gpg --verify alice@example.test report.txtIncorrect. --verify checks a signature and does not create ciphertext.
Incorrect. --verify checks a signature and does not create ciphertext.
gpg --output report.txt.gpg --detach-sign report.txtIncorrect. --detach-sign creates a signature, not confidential ciphertext.
Incorrect. --detach-sign creates a signature, not confidential ciphertext.
Try it yourself
An example you can run in a temporary verification environment.
printf '%s
' '--encrypt=encrypt data' '--recipient=select public key' '--output=output ciphertext file'Expected result
--encrypt=encrypt data
--recipient=select public key
--output=output ciphertext fileKey points
- Use the recipient's public key
- Provide confidentiality
- Separate from signing
Notes
- Environment: GnuPG encryption構文(暗号化なし)
- Command output formatting can vary slightly by distribution or tool version.
- Run the example in a temporary directory or process when possible.
Foundation review
Read the scope first
Check whether the command acts on the current shell, a new process, an existing process, or a file.
Verify the observable result
Use the supplied command and compare the output with the expected result.