I just wanted to make sure I am on the right track
- Sender generates private key, encrypts message
- Sender requests receivers public key
- "Secret" is then encrypted with this public key
- Data sent to receiver for decryption
I assume logically speaking the "Secret" can only be encrypte开发者_JAVA百科d with the receivers public key, although is the encrypted secret attached to the encrypted file / document?
Public key encryption: An easy way to visualize this is as follows:
I send someone an unlocked box that they can put stuff in. Then they close it and it locks. They can ship me the box and I have the only key that will open the lock.
The locked box is the public key encryption; the key is my private key.
Symmetric key encryption works like this:
We buy a padlock at Home Depot and it comes with two keys. You take one and move to Boston; I take one and move to San Jose. We can padlock our box and ship it back and forth, only we have the keys.
p1. Sender generates session symmetric key.
p3. session key is encrypted using this public key.
Yes, the encrypted secret is attached to the encrypted file. There's no risk in this as this is a session (one-time) key.
- Sender generates session symmetric key.
- Symmetric meaning both parties will use the same key.
- Sender encrypts data with session key.
- Sender requests receivers public key.
- Receiver sends public key while keeping the matching private key secret.
- Session key is encrypted using receivers pubic key.
- Now only the receivers private key can decrypt the session key.
- Encrypted Data and encrypted session key are sent to receiver.
- Receiver decrypts senders session key using receivers secret private key.
- Receiver decrypts data using decrypted session key.
Sticking with John Browne's metaphor:
- I lock a document in a box with a key.
- I ask a friend to send me a box to which only they have a key too.
- I place a copy of my document-box-key in my friends box and lock it.
- I send the document box and my friends box (which contains the key to the document box) to my friend.
- My friend opens their box with their secret key, and retrieves the document-box-key from inside.
- My friend then uses that key to open the document box.
精彩评论