Episode Details
Back to Episodes
Course 17 - Computer Network Security Protocols And Techniques | Episode 4: Asymmetric Cryptography: RSA, Diffie-Hellman
Published 4 months, 2 weeks ago
Description
In this lesson, you’ll learn about:
- What asymmetric (public key) cryptography is and why it is needed
- How the RSA algorithm works and where it is used in practice
- How Diffie-Hellman enables secure key exchange over public networks
- Why asymmetric cryptography is vulnerable without authentication
- Public key: Shared with everyone
- Private key: Kept secret by the owner
- Two large prime numbers are selected: P and Q
- These are multiplied to produce n = P × Q
- A public key is created: (n, e)
- A private key is created: (n, d)
- Knowing n does not make it feasible to derive d without factoring n
- The sender converts the message into a number M
- Encryption is performed using the public key:
- C = M^e mod n
- The receiver decrypts using the private key:
- M = C^d mod n
- RSA operations are slow and computationally expensive
- It is not used to encrypt large data
- Instead, RSA is commonly used to:
- Securely exchange a symmetric session key
- Authenticate servers and users
- The exchanged symmetric key is then used with fast algorithms like AES
- Allows two parties to generate a shared symmetric key
- No prior secret is required
- The shared key is never transmitted over the network
- Two public values are agreed upon:
- A large prime number P
- A generator G
- Each party chooses a private value:
- Alice chooses X
- Bob chooses Y
- Public values are exchanged:
- Alice sends G^X mod P
- Bob sends G^Y mod P
- Both compute the same shared secret:
- G^(XY) mod P
- Secure against passive eavesdropping
- Enables perfect forward secrecy when used correctly
- Widely used in secure protocols such as TLS
- An attacker intercepts the key exchange
- Establishes one secret key with Alice
- Establishes a different secret key with Bob
- Relays messages between both sides while decrypting and re-encrypting them