report.txtをalice@example.testのOpenPGP public keyで暗号化し、report.txt.gpgを作る。
自分のprivate keyでの署名は行わない。
適切なコマンドはどれか。
gpg --encrypt --recipient RECIPIENT FILEはrecipientのpublic keyを使って暗号化し、対応private keyだけがsession keyを復号できる。
詳細解説
gpg --output report.txt.gpg --encrypt --recipient alice@example.test report.txtrecipient public keyを選びfileを暗号化する。
正しい。aliceのpublic keyを選んでreport.txtを暗号化し、指定outputへciphertextを保存する。
gpg --output report.txt.gpg --decrypt report.txtdecrypt operationで平文を暗号化しない。
誤り。--decryptは既存ciphertextからplaintextを得る逆方向のoperationである。
gpg --output report.txt.gpg --verify alice@example.test report.txtsignature verificationで暗号文を作らない。
誤り。--verifyはsignature検証で、recipientだけが読めるciphertextを作らない。
gpg --output report.txt.gpg --detach-sign report.txtdetached signatureを作りconfidentialityを提供しない。
誤り。detached signatureはintegrity/authenticity用で、data内容を秘匿しない。
実際に確かめる
一時的な検証環境で実行できる例です。
printf '%s
' '--encrypt=encrypt data' '--recipient=select public key' '--output=output ciphertext file'期待される結果
--encrypt=encrypt data
--recipient=select public key
--output=output ciphertext file理解のポイント
- recipient public key
- confidentiality
- 署名とは別
確認時の注意
- 確認環境: GnuPG encryption構文(暗号化なし)
- 実dataは暗号化しない。
基礎のおさらい
hybrid encryption
OpenPGPはdataをsession keyで暗号化し、そのsession keyをrecipient public keyで保護する。
key selection
email等のuser IDだけでなくfingerprintとtrustを確認し、誤ったrecipient keyへの暗号化を避ける。