Lecture#5 - Assymetric Cryptography
Lecture#5 - Assymetric Cryptography
ASYMMETRIC CRYPTOGRAPHY
Introduction to Asymmetric Cryptography
01 | Sikandar Abbasi
How Asymmetric Cryptography Works
01 | Sikandar Abbasi
Public-Key Cryptography
01 | Sikandar Abbasi
Public-Key Cryptography
01 | Sikandar Abbasi
Public-Key Cryptography
Security Concept
The security of public-key cryptography comes from the fact that, while it is easy to
encrypt a message using the public key, it is extremely difficult to decrypt it without
the private key.
The mathematical problems that underpin public-key cryptography are
computationally "hard" — for example, factoring large prime numbers (RSA) or
solving elliptic curve equations (ECC).
01 | Sikandar Abbasi
Public-Key Cryptography
01 | Sikandar Abbasi
Public-Key Cryptography
Use Cases:
Digital Signatures: Public-key cryptography is used to verify the authenticity and
integrity of digital messages and documents. The sender uses their private key to
"sign" a message, and anyone can verify the signature using the sender’s public key.
SSL/TLS: Public-key cryptography underpins SSL/TLS protocols, which secure
communication over the internet (e.g., HTTPS).
Email Encryption: Protocols like PGP (Pretty Good Privacy) use public-key
cryptography to encrypt email messages.
01 | Sikandar Abbasi
Public-Key Cryptography
RSA (Rivest-Shamir-Adleman)
Overview: RSA is one of the first public-key cryptosystems and remains widely used
today. It is based on the mathematical difficulty of factoring large composite numbers
(multiplying two large prime numbers).
How RSA Works:
Key generation:
Choose two large prime numbers, p and q.
Compute n=p×q, which is used as the modulus for both keys.
Compute ϕ(n)=(p−1)×(q−1).
Choose a public key exponent e (often 65537).
Compute the private key exponent d, such that e×d≡1 mod ϕ(n).
01 | Sikandar Abbasi
RSA (Rivest-Shamir-Adleman)
Encryption:
The sender uses the public key (n, e) to encrypt the message m as: c= mod ϕ(n) ,
where c is the ciphertext.
Decryption:
The recipient uses their private key d to decrypt the ciphertext: m= mod ϕ(n), retrieving
the original message.
01 | Sikandar Abbasi
RSA (Rivest-Shamir-Adleman)
01 | Sikandar Abbasi
RSA (Rivest-Shamir-Adleman)
𝑒 should be a number that is coprime with 𝜙( 𝑛) (i.e., it has no common factors with 60
4. Choose a public exponent (e):
that 𝑑=43.
Using trial and error or a method such as the Extended Euclidean Algorithm, we find
01 | Sikandar Abbasi
RSA (Rivest-Shamir-Adleman)
Step 2: Encryption
1. Message (M):
Suppose we want to encrypt the message M=10.
2. Encryption Formula:
To encrypt, we use the formula C = mod ϕ(n), where:
M is the message (in numerical form).
e and n are from the public key.
3. Encryption Calculation:
C = mod 60
=10000000
10000000 mod 60=17
4. So, the ciphertext (C) is C=40.
01 | Sikandar Abbasi
RSA (Rivest-Shamir-Adleman)
Step 3: Decryption
1. Decryption Formula:
To decrypt, use the formula M= mod ϕ(n), where:
C is the ciphertext.
d and n are from the private key.
2. Decryption Calculation:
M= mod 60
3. This is a large number, but using modular arithmetic or a calculator, we find:
mod 60=10
4. So, the decrypted message is M=10, which matches the original message.
01 | Sikandar Abbasi
RSA (Rivest-Shamir-Adleman)
Advantages:
Well-established and widely used in digital signatures, secure emails, and SSL
certificates.
Disadvantages:
Speed: RSA is slower compared to symmetric algorithms.
Key size: RSA requires large key sizes (2048 bits or more) to be secure, which
increases computational overhead.
01 | Sikandar Abbasi
ECC (Elliptic Curve Cryptography)
Overview:
ECC is a more modern form of public-key cryptography that provides equivalent
security to RSA but with smaller key sizes, making it faster and more efficient.
How ECC Works:
Based on the mathematics of elliptic curves over finite fields.
ECC uses points on a curve to generate keys. The security is based on the
difficulty of the Elliptic Curve Discrete Logarithm Problem (ECDLP).
Example of Curve:
The curve equation is typically of the form: , where a and b define the curve.
01 | Sikandar Abbasi
ECC (Elliptic Curve Cryptography)
Key Generation:
• Choose a random number as the private key.
• Compute the corresponding point on the curve as the public key.
Advantages of ECC:
• Smaller keys: ECC requires much smaller keys compared to RSA for the same
level of security (e.g., a 256-bit ECC key provides security comparable to a 3072-
bit RSA key).
• Faster: Due to its smaller key sizes, ECC performs better on devices with limited
resources, such as smartphones and IoT devices.
Applications:
• Bitcoin and other cryptocurrencies use ECC for creating digital signatures and
securing transactions.
01 | Sikandar Abbasi
Key Exchange Protocols
01 | Sikandar Abbasi
Diffie-Hellman Key Exchange
Vulnerability:
• Man-in-the-middle (MitM) attack: Without authentication, an attacker could
intercept the key exchange and pose as one of the parties.
Applications:
• Commonly used in protocols such as TLS (Transport Layer Security) and VPNs
(Virtual Private Networks) for establishing secure communications.
01 | Sikandar Abbasi
Public Key Infrastructure (PKI)
Overview:
• Public key infrastructure (PKI) is a system that manages the creation, distribution,
and revocation of public keys.
• It includes Certification Authorities (CAs), which issue digital certificates that
verify the identity of the key holders.
Components:
• Digital Certificates: Bind public keys to individuals or organizations, verified by
trusted authorities (CAs).
• Certificate Revocation Lists (CRLs): Track certificates that have been revoked.
Applications:
• Used in securing websites (HTTPS), email encryption, and digital signatures.
01 | Sikandar Abbasi
THANK YOU