2078 2

CSC327 ยท 2078 ยท 10 marks

Explain the generic model of digital signature process. Consider the two prime numbers 7 and 19. Select 29 as public key and 41 as private key. Encrypt the plaintext 4 and decrypt the cipher text 3 using RSA.

Explain the generic model of digital signature process. Consider the two prime numbers 7 and 19. Select 29 as public key and 41 as private key. Encrypt the plaintext 4 and decrypt the cipher text 3 using RSA.[10]

CryptographyChapter 4: Cryptographic Hash Functions and Digital SignaturesDigital SignaturesNumerical: RSA encryption decryption

Digital Signature and RSA

Part 1: Generic Model of Digital Signature Process

A digital signature uses asymmetric (public key) cryptography to provide authentication, integrity, and non-repudiation. The sender signs using their private key; the receiver verifies using the sender's public key.

Model

Sender side:

  1. Message: Sender has the original plaintext message $M$.
  2. Hashing: A hash function $H$ (e.g., SHA-1, MD5) is applied to $M$ to produce a fixed-length message digest $h = H(M)$.
  3. Signing: The digest is encrypted with the sender's private key to form the digital signature $S = E_{PR_{sender}}(h)$.
  4. Transmission: The message $M$ and signature $S$ are sent together.

Receiver side: 5. Recompute hash: Receiver applies the same hash function to the received message: $h_1 = H(M)$. 6. Decrypt signature: Receiver decrypts $S$ with the sender's public key to recover $h_2 = D_{PU_{sender}}(S)$. 7. Compare: If $h_1 = h_2$, the message is authentic and unaltered; otherwise it has been tampered with or is forged.

Sender:   M --H--> h --Encrypt(PR_sender)--> S ;  send (M, S)
Receiver: M --H--> h1
          S --Decrypt(PU_sender)--> h2
          compare h1 == h2 ? valid : invalid

Properties provided: Authentication, Integrity, Non-repudiation.


Part 2: RSA

Given data

  • $p = 7$, $q = 19$
  • Public key $e = 29$
  • Private key $d = 41$
  • Plaintext to encrypt: $M = 4$
  • Ciphertext to decrypt: $C = 3$

Step 1: Parameters

$$n = p \times q = 7 \times 19 = 133$$ $$\phi(n) = (p-1)(q-1) = 6 \times 18 = 108$$

Check: $e \times d = 29 \times 41 = 1189$, and $1189 \mod 108 = 1189 - 11\times108 = 1189-1188 = 1$. โœ“ Keys valid.

Step 2: Encrypt $M = 4$

$$C = M^e \bmod n = 4^{29} \bmod 133$$

Successive squaring mod 133:

  • $4^1 = 4$
  • $4^2 = 16$
  • $4^4 = 16^2 = 256 \equiv 123$
  • $4^8 = 123^2 = 15129 \equiv 6$ (since $15129 - 113\times133 = 15129-15029=100$... recheck)

Recheck $4^8$: $15129 \div 133 = 113.75$, $113\times133 = 15029$, remainder $= 100$. So $4^8 \equiv 100$, not 6.

Redo carefully:

  • $4^4 \equiv 123$
  • $4^8 = 123^2 = 15129$; $133\times113 = 15029$; $15129-15029 = 100 \Rightarrow 4^8 \equiv 100$
  • $4^{16} = 100^2 = 10000$; $133\times75 = 9975$; $10000-9975 = 25 \Rightarrow 4^{16} \equiv 25$

Binary: $29 = 16+8+4+1$, so $$4^{29} = 4^{16}\cdot 4^{8}\cdot 4^{4}\cdot 4^{1} \equiv 25 \times 100 \times 123 \times 4 \pmod{133}$$

Step by step:

  • $25 \times 100 = 2500;\ 2500 - 18\times133 = 2500 - 2394 = 106$
  • $106 \times 123 = 13038;\ 13038 - 98\times133 = 13038 - 13034 = 4$
  • $4 \times 4 = 16$

$$\boxed{C = 4^{29} \bmod 133 = 16}$$

Step 3: Decrypt $C = 3$

$$M = C^d \bmod n = 3^{41} \bmod 133$$

Successive squaring mod 133:

  • $3^1 = 3$
  • $3^2 = 9$
  • $3^4 = 81$
  • $3^8 = 81^2 = 6561;\ 6561 - 49\times133 = 6561-6517 = 44$
  • $3^{16} = 44^2 = 1936;\ 1936 - 14\times133 = 1936-1862 = 74$
  • $3^{32} = 74^2 = 5476;\ 5476 - 41\times133 = 5476-5453 = 23$

Binary: $41 = 32 + 8 + 1$, so $$3^{41} = 3^{32}\cdot 3^{8}\cdot 3^{1} \equiv 23 \times 44 \times 3 \pmod{133}$$

  • $23 \times 44 = 1012;\ 1012 - 7\times133 = 1012 - 931 = 81$
  • $81 \times 3 = 243;\ 243 - 133 = 110$

$$\boxed{M = 3^{41} \bmod 133 = 110}$$

Final Results

  • Encryption of plaintext $4$: $C = 16$
  • Decryption of ciphertext $3$: $M = 110$

Short on time? The 1, 5 and 10 mark versions of this answer, flashcards and practice sets come with a program pass.