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. 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.
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
Host key
A server identity key used by SSH clients to detect a changed endpoint.
User key
A key pair used to authenticate a user to an SSH server.
Port forwarding
An SSH tunnel that carries traffic between a local, remote, or dynamic endpoint.