Asymmetric Cyrptography

Symmetric-Key Encryption

  • Definition: A method of encryption that uses an invertible function.

  • Security: Depends on a shared secret key.

  • Characteristics:

    • Fast and highly secure.

    • Suitable for repeated communication.

  • Problem: The challenge lies in how to securely share the key with the intended receiver.

Asymmetric-Key (Public Key) Encryption

  • Basic Idea:

    • Each user has two keys: a public key and a private key.

    • Encryption/Decryption:

      • Message is encrypted using the public key and decrypted with the private key for confidentiality.

      • Message can be encrypted with the private key and decrypted with the public key to provide authenticity (digital signatures).

One-Way Functions

  • Definition: Functions that are easy to compute in one direction but hard to invert.

    • Example of invertible functions: Multiplication and division.

    • Example functions: DES (Data Encryption Standard).

  • Types:

    • One-way function: Hard to compute the inverse without additional knowledge.

    • Trapdoor one-way function: Can be inverted easily if additional knowledge (e.g., private key) is available.

Public Key Encryption & One-Way Functions

  • Basis for Public Key Encryption:

    • Relies on the existence of trapdoor one-way functions.

    • Encryption Process: Easy, using the public key.

    • Decryption Process: Computationally challenging without the private key.

    • Having the private key makes inverting the function trivial (i.e., opens the trapdoor).

Digital Signatures

  • Purpose: Provides authentication, integrity, and non-repudiation for messages.

  • Implementation:

    • A digital signature is created by encrypting the message with the sender's private key.

    • Validates authenticity and integrity of a message, software, or digital document.

Privacy Using Asymmetric-Key Encryption

  • Diagram of communication:

    • Alice encrypts a message using Bob's public key.

    • Bob decrypts the message with his private key.

  • Encryption and Decryption Process:

    • Plaintext is converted to ciphertext through encryption when sent over the network and vice versa for the receiver.

Signing the Whole Document

  • Process:

    • Alice encrypts the document and signs it, sending it to Bob.

    • Bob receives the signed document.

  • Implication: Ensures that the integrity of the document remains intact.

TCP/IP Protocol Suite

  • Note: Digital signatures alone do not provide privacy. For privacy, an additional layer of encryption/decryption is necessary.

Hash Function

  • Functionality:

    • Converts a variable-length message into a fixed-length message digest.

    • Used to ensure message integrity.

Sender Site Diagram (TCP/IP Protocol Suite)

  • Process Flow:

    • Alice's private key is used to create a hash and sign the digest.

    • The message plus the signed digest is sent to Bob.

Receiver Site Diagram (TCP/IP Protocol Suite)

  • Process Flow:

    • Bob receives the message from Alice.

    • Bob decrypts the message and compares the digest to verify integrity.

RSA Algorithm Overview

  1. Select large primes p and q.

  2. Compute n = pq.

  3. Calculate φ(n) = (p-1)(q-1).

  4. Choose e such that it is relatively prime to φ(n).

  5. Find d such that ed ≡ 1 (mod φ(n)).

  6. Result: Public key is (e,n) and private key is (d,n).

Example of RSA

  • Given: p = 11, q = 13.

  • Calculations:

    • n = pq = 143.

    • φ(n) = (p-1)(q-1) = 120.

    • Choose e (e.g., 7). Check gcd(e, 120) = 1.

    • Find d: d*7 ≡ 1 (mod 120) → d = 103.

  • Keys:

    • Public Key: (7, 143).

    • Private Key: (103, 143).

  • Message Encryption: E(42) = 42^7 (mod 143) = 81.

  • Message Decryption: D(81) = 81^103 (mod 143) = 42.

Second RSA Example

  • Given: p = 3, q = 11.

  • Calculations:

    • n = pq = 33.

    • φ(n) = (p-1)(q-1) = 20.

    • Choose e = 3.

    • Find d where 3d ≡ 1 (mod 20) → d = 7.

    • C = 9^3 mod 33 = 3.

    • M = 3^7 mod 33 = 9.

Strengths of RSA

  • Advantages:

    • No prior communication required for setting up the keys.

    • Highly secure (when sufficiently large keys are used).

    • Well-understood and widely used protocol.

    • Supports both encryption and signing capabilities.

Weaknesses of RSA

  • Disadvantages:

    • Requires large key sizes (1024 bits or more is standard).

    • Relatively slow, making it impractical for large messages.

    • Public keys must be distributed securely to prevent compromise.

Security of RSA

  • Security Basis:

    • Dependent on the difficulty of deriving the private key d from the public key e and modulus n.

    • Equivalent to the integer factorization problem: finding primes p and q given n.

    • Factorization is considered computationally hard, though not proven.