The sender must encrypt a document so that only the recipient can decrypt it with public-key cryptography.
Which keys should be used?
Encrypt with the recipient's public key and decrypt with the corresponding recipient's private key.
Detailed explanation
Incorrect. Encrypting with the recipient's private key is not the confidentiality construction requested.
Incorrect. Encrypting with the recipient's private key is not the confidentiality construction requested.
Incorrect. This lets the sender, rather than the recipient, decrypt the message.
Incorrect. This lets the sender, rather than the recipient, decrypt the message.
Correct. Anyone can use the recipient's public key to encrypt, but only the matching private key decrypts it.
Correct. Anyone can use the recipient's public key to encrypt, but only the matching private key decrypts it.
Incorrect. A private key must never be sent with the message.
Incorrect. A private key must never be sent with the message.
Try it yourself
An example you can run in a temporary verification environment.
printf '%s\n' 'recipient public key -> recipient private key'Expected result
recipient public key -> recipient private keyKey points
- Encrypt with public key
- Decrypt with private key
- Confidentiality
Notes
- Environment: 公開鍵暗号の概念確認
- 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.