Skip to main content

Week - 7

TITLE

Lecture 31:
Generalised ElGamal Public Key Cryptosystem

Setup (General)

  • Cyclic group:

    GG
  • Generator:

    α\alpha
  • Private key:

    aa
  • Public key:

    β=αa\beta = \alpha^a
  • Public:

    (G,α,β)(G,\alpha,\beta)

Encryption

Choose random:

kk

Ciphertext:

y1=αky_1 = \alpha^k y2=xβky_2 = x \cdot \beta^k

Decryption

x=y2(y1a)1x = y_2 \cdot (y_1^a)^{-1}

Core Hard Problem

β=αafind a\beta = \alpha^a \Rightarrow \text{find } a

(Discrete Log Problem)


Elliptic Curve Version

  • Group:

    E(Zp)E(\mathbb{Z}_p)
  • Operation: point addition


Keys

  • Generator point:

    α\alpha
  • Private key:

    aa
  • Public key:

    β=aα\beta = a\alpha

Encryption (ECC)

Choose random:

kk y1=kαy_1 = k\alpha y2=x+kβy_2 = x + k\beta

Decryption

x=y2ay1x = y_2 - a y_1

Example Values

  • p=11p = 11

  • Curve:

    y2x3+x+6(mod11)y^2 \equiv x^3 + x + 6 \pmod{11}
  • Generator:

    α=(2,7)\alpha = (2,7)
  • Private:

    a=7a = 7
  • Public:

    β=(7,2)\beta = (7,2)

Encryption Example

Message:

x=(10,9)x = (10,9)

Random:

k=3k = 3 y1=(8,3)y_1 = (8,3) y2=(10,2)y_2 = (10,2)

Decryption

x=(10,2)7(8,3)=(10,9)x = (10,2) - 7(8,3) = (10,9)

Notes

  • Uses point addition instead of multiplication

  • Security based on:

    ECDLP\text{ECDLP}
  • Smaller keys, strong security

TITLE

Lecture 32:
Chinese Remainder Theorem

Linear Equations (mod p)

Given:

4x+7y9(mod13)4x + 7y \equiv 9 \pmod{13} 5x+2y3(mod13)5x + 2y \equiv 3 \pmod{13}

Steps

  • Multiply by inverses:
4110(mod13)4^{-1} \equiv 10 \pmod{13} 518(mod13)5^{-1} \equiv 8 \pmod{13}

Transform

x+5y12(mod13)x + 5y \equiv 12 \pmod{13} x+3y11(mod13)x + 3y \equiv 11 \pmod{13}

Subtract

2y1(mod13)2y \equiv 1 \pmod{13} y7(mod13)y \equiv 7 \pmod{13}

Substitute

x=125y3(mod13)x = 12 - 5y \equiv 3 \pmod{13}

Solution

x=3,y=7x = 3,\quad y = 7

Chinese Remainder Theorem (2 equations)

Given:

xa(modm)x \equiv a \pmod{m} xb(modn)x \equiv b \pmod{n}

Condition:

gcd(m,n)=1\gcd(m,n)=1

General Form

x=a+tmx = a + tm

Substitute:

a+tmb(modn)a + tm \equiv b \pmod{n}

Solve for ( t )

tm1(ba)(modn)t \equiv m^{-1}(b-a) \pmod{n}

Final Solution

x=a+tm(modmn)x = a + tm \pmod{mn}

Example

x3(mod5)x \equiv 3 \pmod{5} x5(mod7)x \equiv 5 \pmod{7}

Compute

513(mod7)5^{-1} \equiv 3 \pmod{7} t=3(53)6(mod7)t = 3(5-3) \equiv 6 \pmod{7}

Result

x=3+56=33x = 3 + 5 \cdot 6 = 33 x33(mod35)x \equiv 33 \pmod{35}

General CRT (r equations)

Given:

xai(modmi)x \equiv a_i \pmod{m_i}

Condition:

gcd(mi,mj)=1\gcd(m_i,m_j)=1

Define

M=miM = \prod m_i Mi=MmiM_i = \frac{M}{m_i} yi=Mi1(modmi)y_i = M_i^{-1} \pmod{m_i}

Solution

x=aiMiyi(modM)x = \sum a_i M_i y_i \pmod{M}

Key Properties

  • Unique solution:

    mod(mi)\mod \left(\prod m_i\right)
  • Works only if moduli are pairwise coprime


Key Insight

  • Break big modulus into smaller ones
  • Solve separately
  • Combine using CRT

Final Note

  • Used in:

    • RSA optimization
    • Cryptographic computations
TITLE

Lecture 33:
Rabin Cryptosystem

Quadratic Residue

Definition:

a is quadratic residue mod p    y: y2a(modp)a \text{ is quadratic residue mod } p \iff \exists y:\ y^2 \equiv a \pmod{p}

Euler Criterion

ap121(modp);;;;a is QRa^{\frac{p-1}{2}} \equiv 1 \pmod{p} ;; \Rightarrow ;; a \text{ is QR} ap121(modp);;;;a is non-QRa^{\frac{p-1}{2}} \equiv -1 \pmod{p} ;; \Rightarrow ;; a \text{ is non-QR}

Square Root (Special Case)

If:

p3(mod4)p \equiv 3 \pmod{4}

Then:

y±ap+14(modp)y \equiv \pm a^{\frac{p+1}{4}} \pmod{p}

Key Generation

  • Choose primes:
pq3(mod4)p \equiv q \equiv 3 \pmod{4}
  • Compute:
n=pqn = pq
  • Public key:
nn
  • Private key:
(p,q)(p, q)

Plaintext Space

xZnx \in \mathbb{Z}_n^*

Encryption

yx2(modn)y \equiv x^2 \pmod{n}

Decryption

Solve:

x2y(modn)x^2 \equiv y \pmod{n}

Using CRT:

x2y(modp)x^2 \equiv y \pmod{p} x2y(modq)x^2 \equiv y \pmod{q}

Roots

From each:

x±yp+14(modp)x \equiv \pm y^{\frac{p+1}{4}} \pmod{p} x±yq+14(modq)x \equiv \pm y^{\frac{q+1}{4}} \pmod{q}

Total Solutions

4 possible values of x4 \text{ possible values of } x

Example

Given:

p=7,;q=11,;n=77p = 7,; q = 11,; n = 77

Ciphertext:

y=23y = 23

Solve

x223(mod7)x^2 \equiv 23 \pmod{7} x223(mod11)x^2 \equiv 23 \pmod{11}

Final Solutions

x10,32,45,67x \in {10, 32, 45, 67}

Key Points

  • Not injective → 1 ciphertext → 4 plaintexts
  • Requires guessing / redundancy
  • Based on square root modulo problem

Insight

  • Uses:

    • CRT
    • Quadratic residues
    • Modular square roots
  • Limitation:

    • Ambiguity (4 solutions) → not widely used
TITLE

Lecture 34:
Legendre and Jacobi Symbol

Quadratic Residues Count

  • In ( Zp\mathbb{Z}_p ) (p prime):
QR=Non-QR=p12|\text{QR}| = |\text{Non-QR}| = \frac{p-1}{2}

Construction

Set:

12,22,...,(p12)2modp{1^2, 2^2, ..., (\frac{p-1}{2})^2} \mod p

✔ Gives all quadratic residues


Legendre Symbol

(ap)={0pa 1a is QR mod p 1a is non-QR mod p\left(\frac{a}{p}\right) = \begin{cases} 0 & p \mid a \ 1 & a \text{ is QR mod } p \ -1 & a \text{ is non-QR mod } p \end{cases}

Euler Relation

(ap)ap12modp\left(\frac{a}{p}\right) \equiv a^{\frac{p-1}{2}} \mod p

Multiplicative Property

(mnp)=(mp)(np)\left(\frac{mn}{p}\right) = \left(\frac{m}{p}\right)\left(\frac{n}{p}\right)

Special Values

For ( -1 )

(1p)=(1)p12\left(\frac{-1}{p}\right) = (-1)^{\frac{p-1}{2}}
  • (= 1) if:

    p1(mod4)p \equiv 1 \pmod{4}
  • (= -1) if:

    p3(mod4)p \equiv 3 \pmod{4}

For ( 2 )

(2p)=(1)p218\left(\frac{2}{p}\right) = (-1)^{\frac{p^2 - 1}{8}}
  • (= 1) if:

    p±1(mod8)p \equiv \pm 1 \pmod{8}
  • (= -1) if:

    p±3(mod8)p \equiv \pm 3 \pmod{8}

Congruence Property

If:

ab(modp)a \equiv b \pmod{p}

Then:

(ap)=(bp)\left(\frac{a}{p}\right) = \left(\frac{b}{p}\right)

Jacobi Symbol

For:

n=p1e1p2e2pkekn = p_1^{e_1} p_2^{e_2} \cdots p_k^{e_k}

Define:

(an)=(ap1)e1(ap2)e2(apk)ek\left(\frac{a}{n}\right) = \left(\frac{a}{p_1}\right)^{e_1} \left(\frac{a}{p_2}\right)^{e_2} \cdots \left(\frac{a}{p_k}\right)^{e_k}

Properties (Jacobi)

(abn)=(an)(bn)\left(\frac{ab}{n}\right) = \left(\frac{a}{n}\right)\left(\frac{b}{n}\right) (amn)=(am)(an)\left(\frac{a}{mn}\right) = \left(\frac{a}{m}\right)\left(\frac{a}{n}\right)

Quadratic Reciprocity

(mn)(nm)=(1)(m1)(n1)4\left(\frac{m}{n}\right)\left(\frac{n}{m}\right) = (-1)^{\frac{(m-1)(n-1)}{4}}

Key Insight

  • Fast QR checking using:

    ap12modpa^{\frac{p-1}{2}} \mod p
  • Used in:

    • Primality testing
    • Cryptography

Note

  • Jacobi ≠ guarantee of QR
  • Only: (an)=1non-QR\left(\frac{a}{n}\right) = -1 \Rightarrow \text{non-QR}

Use

  • Efficient computation of residue properties
  • Important in crypto algorithms
TITLE

Lecture 35:
Jacobi Symbol (Contd.)

Jacobi Symbol Computation

Given:

(an),n=p1e1p2e2pkek\left(\frac{a}{n}\right), \quad n = p_1^{e_1} p_2^{e_2} \cdots p_k^{e_k} (an)=(ap1)e1(ap2)e2(apk)ek\left(\frac{a}{n}\right) = \left(\frac{a}{p_1}\right)^{e_1} \left(\frac{a}{p_2}\right)^{e_2} \cdots \left(\frac{a}{p_k}\right)^{e_k}

Example Structure

For:

n=9975=352719n = 9975 = 3 \cdot 5^2 \cdot 7 \cdot 19 (62789975)=(62783)(62785)2(62787)(627819)\left(\frac{6278}{9975}\right) = \left(\frac{6278}{3}\right) \left(\frac{6278}{5}\right)^2 \left(\frac{6278}{7}\right) \left(\frac{6278}{19}\right)

✔ Reduce using:

ab(modp)a \equiv b \pmod{p}

Euler-Based Check

(ap)ap12modp\left(\frac{a}{p}\right) \equiv a^{\frac{p-1}{2}} \mod p

Euler Pseudoprime

If:

(an)an12modn\left(\frac{a}{n}\right) \equiv a^{\frac{n-1}{2}} \mod n

Then:

  • (n) behaves like prime for base (a)
  • Called Euler pseudoprime

Solovay–Strassen Test

Input:

  • Odd integer ( n > 2 )

Steps:

  1. Choose random:
a[1,n1]a \in [1, n-1]
  1. Compute:
x=(an)x = \left(\frac{a}{n}\right)
  1. Compute:
yan12modny \equiv a^{\frac{n-1}{2}} \mod n

Decision:

  • If:
x=0x = 0

→ (n) is composite


  • If:
y≢xmodny \not\equiv x \mod n

→ (n) is composite


  • Else:

→ (n) is probably prime


Property

  • If algorithm says composite → always correct
  • If prime → probabilistic

Goldwasser–Micali Cryptosystem

Key Generation

  • Choose primes:
p,qp, q
  • Compute:
n=pqn = pq
  • Choose:
m such that (mp)=1,;(mq)=1m \text{ such that } \left(\frac{m}{p}\right) = -1,; \left(\frac{m}{q}\right) = -1

Then:

(mn)=1\left(\frac{m}{n}\right) = 1

✔ (m) = pseudo-quadratic residue


Public Key

(n,m)(n, m)

Private Key

(p,q)(p, q)

Encryption

Plaintext:

x0,1x \in {0,1}

Choose random:

rZnr \in \mathbb{Z}_n^*

Ciphertext:

yr2mxmodny \equiv r^2 \cdot m^x \mod n

Decryption

Check QR:

  • If:
y is QR mod p and qy \text{ is QR mod } p \text{ and } q

x=0x = 0
  • Else:
x=1x = 1

Key Insight

  • Security based on:

    • Difficulty of distinguishing QR vs non-QR
    • Without knowing (p, q)

Important Note

  • Jacobi = 1 does NOT guarantee QR
  • Used to hide bit information securely

Use

  • Probabilistic primality testing
  • Bit encryption scheme (GM cryptosystem)