- Symmetric key cryptography
- Asymmetric key cryptography (public key cryptography)
Symmetric key cryptography is analogous to two parties using the same key to lock and unlock a box containing secret contents. It's symmetric because the keys used to lock and unlock are identical. In a an exchange using symmetric key cryptography, Bob encrypts data using key A and sends it over to Alice who decrypts it using key A. Anyone who possesses key A can decrypt the data.
Asymmetric key cryptography is when two parties use a pair of different keys to lock and unlock a box containing secret contents. One key to lock, the other one to unlock. One is known as the public key (shared with senders) and the other the private key (guarded by receiver). They're asymmetric because the locking key is not the same as the unlocking key. In an exchange using asymmetric key cryptography, Bob shares his public key with Alice and Alice uses the public key to encrypt the data. Alice sends the data to Bob and he decrypts it using his private key. Since Bob is the only person with the private key, only he can decrypt the data. The public key is like a mailbox you can give to anyone where anyone can put messages in but the only person who can take messages out is the owner of the mailbox.
PGP combines both methods to allow for secure communication. Basically, it uses public key cryptography to encrypt a randomly generated temporary session key which is also used to encrypt data.
Here's how it works:
- Bob shares his public PGP key with Alice.
- Alice wants to send a message and generates a random session key.
- Alice uses the session key to encrypt her message.
- Alice encrypts the session key itself using Bob's public key so that the session key can be sent securely with the encrypted data.
- Bob receives the encrypted data and the encrypted session key.
- Bob decrypts the session key.
- Bob uses the decrypted session key to decrypt the data.
No comments:
Post a Comment