CSS411 Cryptography

Past Exam Questions

All questions from the CSS411 mid-semester (October 2025) and end-semester (November 2025) papers of batch 2022, with marks and model answers.

36 min read

Question indexSearch on YouTube

The two papers come from the file SEM VII - Batch 2022.pdf. Both papers allow a calculator. Every question is compulsory.

ExamPaperMax marksTime
Mid-semOctober 2025 (the paper prints the code ICS412)501.5 hours
End-semNovember 2025, CSS4111003 hours
No.QuestionMarksExamNotes page
M1RSA private key, encryption and decryption5Mid-semRSA
M2Playfair decryption10 (5 + 5)Mid-semClassical ciphers
M3AES MixColumns on one column15Mid-semMixColumns
M4CFB and OFB with 128-bit blocks10Mid-semBlock cipher modes
M5DES, AES or a lightweight cipher for a bank app10Mid-semAES
E1Active and passive attacks15End-semIntroduction
E2Diffie-Hellman shared key10End-semDiffie-Hellman
E3Needham-Schroeder session key10End-semKey management
E4RSA signatures and DSA signatures10End-semDigital signatures
E5Elliptic curve point check and 3P15 (5 + 10)End-semECC
E6SHA-1 blocks and padding10End-semSHA
E7DES complementation property10End-semDES
E8TLS and IPSec for an e-commerce system20 (4 x 5)End-semSSL/TLS

Numerical questions give 30 of the 50 mid-sem marks (M1, M2, M3) and 35 of the 100 end-sem marks (E2, E5, E6). Practise RSA, Diffie-Hellman, ECC point arithmetic, MixColumns and SHA padding until they are fast.

Mid-semester (October 2025)Search on YouTube

M1. RSA key and messageSearch on YouTube

Exam: Mid-sem. Marks: 5.

Question. A server uses RSA with p=19p=19, q=29q=29, e=11e=11. The message is m=25m=25. Find the private key and do encryption and decryption.

Answer.

  1. Calculate the modulus: n=pq=19×29=551n = pq = 19 \times 29 = 551.
  2. Calculate Euler's totient: ϕ(n)=(p−1)(q−1)=18×28=504\phi(n) = (p-1)(q-1) = 18 \times 28 = 504.
  3. Make sure that gcd⁡(11,504)=1\gcd(11, 504) = 1. This is true, so e=11e = 11 is valid.
  4. Find d=e−1 mod 504d = e^{-1} \bmod 504 with the extended Euclidean algorithm:
504=45×11+911=1×9+29=4×2+1\begin{aligned} 504 &= 45 \times 11 + 9 \\ 11 &= 1 \times 9 + 2 \\ 9 &= 4 \times 2 + 1 \end{aligned}

Work back: 1=9−4×2=5×9−4×11=5×504−229×111 = 9 - 4 \times 2 = 5 \times 9 - 4 \times 11 = 5 \times 504 - 229 \times 11. Thus d=−229 mod 504=275d = -229 \bmod 504 = 275.

Check: 11×275=3025=6×504+111 \times 275 = 3025 = 6 \times 504 + 1. The result is correct.

KeyValue
Public key PUPU{e,n}={11,551}\{e, n\} = \{11, 551\}
Private key PRPR{d,n}={275,551}\{d, n\} = \{275, 551\}
  1. Encrypt with square-and-multiply. Use 11=8+2+111 = 8 + 2 + 1:
252≡74,254≡517,258≡54(mod551)25^2 \equiv 74,\quad 25^4 \equiv 517,\quad 25^8 \equiv 54 \pmod{551} C=2511≡54×74×25≡139×25≡169(mod551)C = 25^{11} \equiv 54 \times 74 \times 25 \equiv 139 \times 25 \equiv 169 \pmod{551}
  1. Decrypt: M=169275 mod 551=25M = 169^{275} \bmod 551 = 25. The result is the original message.

To check the decryption quickly, use the Chinese Remainder Theorem. Modulo 19: 169≡17169 \equiv 17 and 275 mod 18=5275 \bmod 18 = 5, so 175≡6≡25(mod19)17^5 \equiv 6 \equiv 25 \pmod{19}. Modulo 29, the same method gives 2525.

M2. Playfair decryptionSearch on YouTube

Exam: Mid-sem. Marks: 10 (key square 5, decryption 5).

Question. Decrypt with Playfair. Key phrase: SECURITY LAB (I/J combined). Ciphertext: VTTDVTIYADUDIYUV. (a) Build the 5x5 key square. (b) Split into digraphs and apply the inverse rules: same row, move left; same column, move up; rectangle, swap columns. Remove the padding X only when it is clearly a filler.

Answer (a): the key square. Write the key letters without repeats (S E C U R I T Y L A B). Then add the remaining letters in alphabetical order. I and J share one cell.

SECUR
ITYLA
BDFGH
KMNOP
QVWXZ

Answer (b): decryption.

DigraphPositionsRulePlaintext
VTSame column 2Move upME
TDSame column 2Move upET
VTSame column 2Move upME
IYSame row 2Move leftAT
ADRectangleSwap columnsTH
UDRectangleSwap columnsEG
IYSame row 2Move leftAT
UVRectangleSwap columnsEX

Result: MEETMEATTHEGATEX. The last X is a filler that makes the length even. Remove it.

Plaintext: MEET ME AT THE GATE.

In the row rule, move left with wrap-around. For IY, I is in column 1, so its left neighbour is A in column 5.

M3. AES MixColumnsSearch on YouTube

Exam: Mid-sem. Marks: 15.

Question. Do the MixColumns operation on one column. The input column is [s0,s1,s2,s3]=[63,FC,AC,16][s_0, s_1, s_2, s_3] = [63, FC, AC, 16] (hex). Use the AES MixColumns matrix. Do all arithmetic in GF(28)GF(2^8). Use bitwise XOR for addition. For multiplication, multiply the polynomials modulo the irreducible polynomial 0x11B.

[s0′s1′s2′s3′]=[02030101010203010101020303010102][63FCAC16]\begin{bmatrix} s'_0 \\ s'_1 \\ s'_2 \\ s'_3 \end{bmatrix} = \begin{bmatrix} 02 & 03 & 01 & 01 \\ 01 & 02 & 03 & 01 \\ 01 & 01 & 02 & 03 \\ 03 & 01 & 01 & 02 \end{bmatrix} \begin{bmatrix} 63 \\ FC \\ AC \\ 16 \end{bmatrix}

The printed paper shows 1 in row 3, column 1 of the matrix. Read it as 01, the standard AES value.

Answer.

Step 1. Multiply by 02 with xtime. Shift left by one bit. If the high bit was 1, XOR the result with 1B.

ByteBinaryShift leftHigh bit was 1?02⋅02 \cdot byte
630110 00111100 0110NoC6
FC1111 11001111 1000Yes, XOR 1BE3
AC1010 11000101 1000Yes, XOR 1B43
160001 01100010 1100No2C

Step 2. Multiply by 03 with 03⋅x=(02⋅x)⊕x03 \cdot x = (02 \cdot x) \oplus x.

Byte03⋅03 \cdot byte
63C6⊕63=A5C6 \oplus 63 = A5
FCE3⊕FC=1FE3 \oplus FC = 1F
AC43⊕AC=EF43 \oplus AC = EF
162C⊕16=3A2C \oplus 16 = 3A

Step 3. XOR the four products of each row.

s0′=C6⊕1F⊕AC⊕16=63s1′=63⊕E3⊕EF⊕16=79s2′=63⊕FC⊕43⊕3A=E6s3′=A5⊕FC⊕AC⊕2C=D9\begin{aligned} s'_0 &= C6 \oplus 1F \oplus AC \oplus 16 = 63 \\ s'_1 &= 63 \oplus E3 \oplus EF \oplus 16 = 79 \\ s'_2 &= 63 \oplus FC \oplus 43 \oplus 3A = E6 \\ s'_3 &= A5 \oplus FC \oplus AC \oplus 2C = D9 \end{aligned}

Output column: [63,79,E6,D9][63, 79, E6, D9].

Show the intermediate XORs for full marks. For s0′s'_0: C6⊕1F=D9C6 \oplus 1F = D9, then D9⊕AC=75D9 \oplus AC = 75, then 75⊕16=6375 \oplus 16 = 63.

M4. CFB and OFB modesSearch on YouTube

Exam: Mid-sem. Marks: 10.

Question. Show how encryption and decryption with 128 input bits work in cipher feedback (CFB) mode and output feedback (OFB) mode. Give the advantages and limitations.

Answer. Use a 128-bit block cipher EE (for example, AES) with key KK. Both modes treat the message as a stream of bits. Both modes use only the encryption function of the block cipher, also for decryption.

CFB (full 128-bit feedback, CFB-128).

C1=P1⊕EK(IV),Ci=Pi⊕EK(Ci−1)C_1 = P_1 \oplus E_K(IV), \qquad C_i = P_i \oplus E_K(C_{i-1}) P1=C1⊕EK(IV),Pi=Ci⊕EK(Ci−1)P_1 = C_1 \oplus E_K(IV), \qquad P_i = C_i \oplus E_K(C_{i-1})
  1. Load the 128-bit IV into the shift register.
  2. Encrypt the register. XOR the output with the 128-bit plaintext segment. The result is the ciphertext segment.
  3. Feed the ciphertext segment back into the register for the next stage.
  4. To decrypt, encrypt the same register values and XOR them with the ciphertext.

In CFB-ss, only ss bits (1, 8 or 64) go out each step. The register shifts left by ss bits and takes in the ss ciphertext bits.

OFB.

O0=IV,Oi=EK(Oi−1),Ci=Pi⊕Oi,Pi=Ci⊕OiO_0 = IV, \qquad O_i = E_K(O_{i-1}), \qquad C_i = P_i \oplus O_i, \qquad P_i = C_i \oplus O_i
  1. Encrypt the IV. The output is the first keystream block O1O_1.
  2. XOR O1O_1 with the 128-bit plaintext block to get C1C_1.
  3. Feed O1O_1 (not the ciphertext) back as the next input.
  4. To decrypt, make the same keystream and XOR it with the ciphertext.
ModeAdvantagesLimitations
CFBThe most common stream mode. Good when data arrives in bits or bytes. Needs no padding.The cipher must stall for one block encryption after every ss bits. A bit error propagates for several blocks.
OFBThe feedback does not depend on the message, so you can compute the keystream in advance. Bit errors do not propagate.The IV must be unique for each use. If you use an IV again, the keystream repeats (the one-time pad problem). An attacker can change ciphertext bits and get the same change in the plaintext.

M5. Cipher for a mobile bank appSearch on YouTube

Exam: Mid-sem. Marks: 10.

Question. A bank wants to secure real-time transactions on its mobile app. The app runs on modern smartphones with sufficient CPU and memory. Which algorithm do you recommend: DES, AES, or a lightweight version? Give reasons. Think about security strength, resistance to brute force attacks, and device resources.

Answer. Recommend AES (AES-128, or AES-256 for long-term protection).

PointDESAESLightweight cipher
Key size56 bits (256≈7.2×10162^{56} \approx 7.2 \times 10^{16} keys)128, 192 or 256 bitsOften 80 to 128 bits
Block size64 bits128 bitsOften 32 to 64 bits
Brute forceBroken. EFF hardware found a key in a few days in 199821282^{128} trials or more: not possibleLower margin. Made for small devices
StatusWithdrawn. Use only as Triple DES in old systemsNIST standard (Rijndael), used in TLSFor sensors, RFID and IoT chips
Speed on a phoneSlow in software, and Triple DES is three times slowerFast. Modern phone CPUs have AES instructionsFast, but the speed gain is not necessary here

Reasons:

  1. Security strength. AES has a large key and a 128-bit block. No practical attack is known against full AES.
  2. Brute force. A 56-bit DES key is too short. A 128-bit AES key space is far too large to search.
  3. Device resources. A modern smartphone has enough CPU and memory. Thus a lightweight cipher gives no real advantage. Lightweight ciphers are for constrained devices.
  4. Real-time use. AES in a fast mode (CTR, or GCM in TLS) adds very little delay to each transaction.

End-semester (November 2025)Search on YouTube

E1. Active and passive attacksSearch on YouTube

Exam: End-sem. Marks: 15.

Question. Describe the active and passive security attacks that occur on the Internet. Explain how each attack works. Give one real-world example for each category.

Answer.

Passive attacks read or monitor the transmission. They do not change the data, so detection is very difficult. The defence is prevention, usually by encryption.

Passive attackHow it works
Release of message contentsThe opponent reads the contents of an e-mail, a file transfer or a phone call.
Traffic analysisThe message is encrypted. The opponent still sees the source, destination, size and frequency, and guesses the nature of the communication.

Real-world example: an attacker on a public Wi-Fi network captures unencrypted (HTTP) traffic with a packet sniffer and reads passwords.

Active attacks change the data stream or create a false stream. They are difficult to prevent. The aim is to detect them and recover.

Active attackHow it works
MasqueradeOne entity pretends to be a different entity. It usually includes another active attack, for example replay of captured authentication data.
ReplayThe opponent captures a data unit and sends it again later to get an unauthorized effect.
Modification of messagesThe opponent changes part of a legitimate message, or delays or reorders messages.
Denial of serviceThe opponent prevents the normal use of communication facilities, for example by flooding a server.

Real-world example: the 2016 Mirai botnet attack on the DNS provider Dyn. It was a distributed denial-of-service attack that made many large websites unavailable.

PointPassiveActive
Effect on dataNo changeChange or false data
DetectionVery difficultEasier
PreventionEasier (encryption)Very difficult
Security goal attackedConfidentialityIntegrity, authenticity, availability

E2. Diffie-Hellman shared keySearch on YouTube

Exam: End-sem. Marks: 10.

Question. Parties A and B set up a common secret key with Diffie-Hellman. They agree on the modulus q=7q = 7 and the primitive root α=3\alpha = 3. A chooses the secret XA=2X_A = 2. B chooses the secret XB=5X_B = 5. Calculate the common secret key on both ends.

Answer.

  1. A calculates its public key: YA=αXA mod q=32 mod 7=9 mod 7=2Y_A = \alpha^{X_A} \bmod q = 3^2 \bmod 7 = 9 \bmod 7 = 2.
  2. B calculates its public key: YB=αXB mod q=35 mod 7=243 mod 7=5Y_B = \alpha^{X_B} \bmod q = 3^5 \bmod 7 = 243 \bmod 7 = 5.
  3. A and B exchange YAY_A and YBY_B.
  4. A calculates K=YBXA mod q=52 mod 7=25 mod 7=4K = Y_B^{X_A} \bmod q = 5^2 \bmod 7 = 25 \bmod 7 = 4.
  5. B calculates K=YAXB mod q=25 mod 7=32 mod 7=4K = Y_A^{X_B} \bmod q = 2^5 \bmod 7 = 32 \bmod 7 = 4.

The common secret key is K=4K = 4. Both values are equal because K=αXAXB mod q=310 mod 7=4K = \alpha^{X_A X_B} \bmod q = 3^{10} \bmod 7 = 4.

E3. Needham-Schroeder protocolSearch on YouTube

Exam: End-sem. Marks: 10.

Question. How is the session key shared between two parties with the Needham-Schroeder protocol? Explain in detail with an example.

Answer. A key distribution center (KDC) shares a master key with each user: KaK_a with A and KbK_b with B. A wants a one-time session key KsK_s to talk to B. N1N_1 and N2N_2 are nonces. ff is a known function, for example f(N)=N+1f(N) = N + 1.

StepMessagePurpose
1A → KDC: IDA∥IDB∥N1ID_A \Vert ID_B \Vert N_1A asks for a session key to talk to B.
2KDC → A: E(Ka,[Ks∥IDB∥N1∥E(Kb,[Ks∥IDA])])E(K_a, [K_s \Vert ID_B \Vert N_1 \Vert E(K_b, [K_s \Vert ID_A])])Only A can read it. N1N_1 shows that the reply is fresh and matches the request.
3A → B: E(Kb,[Ks∥IDA])E(K_b, [K_s \Vert ID_A])A forwards the ticket. Only B can read it, and B learns KsK_s and A's identity.
4B → A: E(Ks,N2)E(K_s, N_2)B tests that A has KsK_s.
5A → B: E(Ks,f(N2))E(K_s, f(N_2))A proves that it has KsK_s. This blocks a replay of message 4.

Example. Alice (A) wants to send a file to Bob (B).

  1. Alice sends "Alice, Bob, N1=7341N_1 = 7341" to the KDC.
  2. The KDC makes KsK_s. It sends Alice KsK_s, "Bob" and 73417341, and a ticket for Bob. All of it is encrypted with KaK_a.
  3. Alice decrypts the message, checks 73417341, and sends the ticket E(Kb,[Ks∥Alice])E(K_b, [K_s \Vert \text{Alice}]) to Bob.
  4. Bob decrypts the ticket and sends E(Ks,5120)E(K_s, 5120).
  5. Alice returns E(Ks,5121)E(K_s, 5121). Now both know KsK_s and encrypt the file with it.

Weakness: if an old KsK_s is compromised, an attacker can replay the old message 3 to B. B cannot detect that the ticket is old. Denning's fix adds a timestamp TT to messages 2 and 3. Kerberos uses this idea.

E4. RSA and DSA signaturesSearch on YouTube

Exam: End-sem. Marks: 10.

Question. Explain how RSA-based signatures and DSA-based signatures differ in their approach to building digital signature algorithms.

Answer.

RSA approach. Hash the message: h=H(M)h = H(M). Encrypt the hash with the sender's private key: S=hd mod nS = h^d \bmod n. Send MM and SS. The receiver calculates Se mod nS^e \bmod n with the public key and compares it with H(M)H(M).

DSA (DSS) approach. DSA is a signature-only algorithm. It does not encrypt.

  • Global public values: a 160-bit prime qq, a large prime pp where qq divides p−1p-1, and g=h(p−1)/q mod pg = h^{(p-1)/q} \bmod p.
  • Keys: private x<qx < q, public y=gx mod py = g^x \bmod p.
  • Sign with a new random k<qk < q for each message:
r=(gk mod p) mod q,s=[k−1(H(M)+xr)] mod qr = (g^k \bmod p) \bmod q, \qquad s = [k^{-1}(H(M) + xr)] \bmod q
  • Verify:
w=s−1 mod q,u1=[H(M) w] mod q,u2=(rw) mod q,v=[(gu1yu2) mod p] mod qw = s^{-1} \bmod q,\quad u_1 = [H(M)\,w] \bmod q,\quad u_2 = (rw) \bmod q,\quad v = [(g^{u_1} y^{u_2}) \bmod p] \bmod q

The signature is valid if v=rv = r.

PointRSA signatureDSA signature
MethodEncrypt the hash with the private key. Verify by decryption and comparison.Calculate a pair (r,s)(r, s) from the hash, the private key and a random kk. Verify by a test that does not recover the hash.
Hard problemInteger factorizationDiscrete logarithm (a variant of ElGamal and Schnorr)
RandomnessDeterministic (same message, same signature)Needs a new secret kk for each signature. If kk is used again, the private key leaks.
UsesSignature, encryption and key exchangeSignature only
Signature sizeSame size as nn (1024 bits or more)320 bits (rr and ss, 160 bits each)
SpeedFast verification (small ee)Smaller and faster signing; verification is slower than RSA

E5. Elliptic curve 3PSearch on YouTube

Exam: End-sem. Marks: 15 (check 5, find 3P 10).

Question. The elliptic curve is y2=x3+5x+1(mod71)y^2 = x^3 + 5x + 1 \pmod{71}. The point is P=(7,11)P = (7, 11). (a) Check whether PP is on the curve. (b) Find 3P3P.

Answer (a).

LHS=y2=112=121≡50(mod71)\text{LHS} = y^2 = 11^2 = 121 \equiv 50 \pmod{71} RHS=73+5⋅7+1=343+35+1=379≡24(mod71)\text{RHS} = 7^3 + 5 \cdot 7 + 1 = 343 + 35 + 1 = 379 \equiv 24 \pmod{71}

50≠2450 \ne 24. Thus PP is not on the curve. (The points on the curve with x=7x = 7 are (7,33)(7, 33) and (7,38)(7, 38).)

Answer (b). Write that PP is not on the curve. Then apply the group formulas as the question asks. Use a=5a = 5 and p=71p = 71.

Step 1. Calculate 2P2P (point doubling):

λ=3x12+a2y1=3⋅49+522=15222≡10⋅22−1(mod71)\lambda = \frac{3x_1^2 + a}{2y_1} = \frac{3 \cdot 49 + 5}{22} = \frac{152}{22} \equiv 10 \cdot 22^{-1} \pmod{71}

22−1 mod 71=4222^{-1} \bmod 71 = 42, because 22×42=924=13×71+122 \times 42 = 924 = 13 \times 71 + 1. Thus λ=10×42=420≡65\lambda = 10 \times 42 = 420 \equiv 65.

x3=λ2−2x1=4225−14≡22,y3=λ(x1−x3)−y1=65(7−22)−11≡8(mod71)x_3 = \lambda^2 - 2x_1 = 4225 - 14 \equiv 22, \qquad y_3 = \lambda(x_1 - x_3) - y_1 = 65(7 - 22) - 11 \equiv 8 \pmod{71}

2P=(22,8)2P = (22, 8).

Step 2. Calculate 3P=2P+P3P = 2P + P (point addition):

λ=y2−y1x2−x1=11−87−22=3−15≡3⋅56−1(mod71)\lambda = \frac{y_2 - y_1}{x_2 - x_1} = \frac{11 - 8}{7 - 22} = \frac{3}{-15} \equiv 3 \cdot 56^{-1} \pmod{71}

56−1 mod 71=5256^{-1} \bmod 71 = 52, because 56×52=2912=41×71+156 \times 52 = 2912 = 41 \times 71 + 1. Thus λ=3×52=156≡14\lambda = 3 \times 52 = 156 \equiv 14.

x3=λ2−x1−x2=196−22−7≡25,y3=λ(x1−x3)−y1=14(22−25)−8=−50≡21(mod71)x_3 = \lambda^2 - x_1 - x_2 = 196 - 22 - 7 \equiv 25, \qquad y_3 = \lambda(x_1 - x_3) - y_1 = 14(22 - 25) - 8 = -50 \equiv 21 \pmod{71}

The formulas give 3P=(25,21)3P = (25, 21).

The doubling formula uses aa but not bb. Thus the arithmetic works, but the result is not a real point of the group because PP is not on the curve. State this in your answer. Part (a) gets full marks only for the answer "not on the curve".

E6. SHA-1 padding and blocksSearch on YouTube

Exam: End-sem. Marks: 10.

Question. A message has a size of 10,456 bytes. SHA-1 calculates its hash value. (a) Draw the message generation diagram. (b) Find the number of blocks, the number of message bits in the last block, and the size of the padding for the last block.

Answer (a). The message digest generation:

  1. Append padding bits: a single 1, then 0s, so that the length is 448 mod 512448 \bmod 512.
  2. Append the original length as a 64-bit value.
  3. Split the result into 512-bit blocks M1,M2,…,MNM_1, M_2, \dots, M_N.
  4. Set the 160-bit buffer (A,B,C,D,E)(A, B, C, D, E) to the initial value IVIV.
  5. Process each block with the compression function FF (80 steps). Add the input chaining value to the output: CVi=CVi−1+F(CVi−1,Mi)CV_{i} = CV_{i-1} + F(CV_{i-1}, M_i), with addition modulo 2322^{32} on each word.
  6. The last chaining value CVNCV_N is the 160-bit message digest.
M1 (512)    M2 (512)          MN (512, has padding + length)
   |           |                  |
IV-+->[ F ]-(+)-+->[ F ]-(+)- ... -+->[ F ]-(+)--> 160-bit digest
 160-bit chaining values CV1, CV2, ..., CVN

Answer (b).

  1. Message length: 10456×8=8364810456 \times 8 = 83648 bits.
  2. Full blocks: 83648=163×512+19283648 = 163 \times 512 + 192. Thus there are 163 full blocks, and 192 message bits stay for the last block.
  3. The last block has room for 192+1+64=257≤512192 + 1 + 64 = 257 \le 512 bits. Thus no extra block is necessary.
  4. Padding: 448−192=256448 - 192 = 256 bits. This is one 1 bit followed by 255 zero bits.
  5. Length field: 64 bits, with the value 83648.
ItemValue
Total blocks164
Message bits in the last block192
Padding in the last block256 bits (1 then 255 zeros)
Length field64 bits
Last block check192+256+64=512192 + 256 + 64 = 512

E7. DES complementation propertySearch on YouTube

Exam: End-sem. Marks: 10.

Question. Let y=DES(x,K)y = DES(x, K) and y′=DES(c(x),c(K))y' = DES(c(x), c(K)). Here c(⋅)c(\cdot) is the bitwise complement. Prove that y′=c(y)y' = c(y). That is, if you complement the plaintext and the key, the ciphertext is also complemented. (Use only the high-level structure of DES. The S-box contents are not relevant.)

Answer. Write aˉ\bar{a} for c(a)c(a). Two facts are true for any bit strings aa and bb:

aˉ⊕bˉ=a⊕b,aˉ⊕b=a⊕b‾\bar{a} \oplus \bar{b} = a \oplus b, \qquad \bar{a} \oplus b = \overline{a \oplus b}

Also, a permutation, a selection or an expansion only moves or copies bits. Thus it commutes with the complement: π(aˉ)=π(a)‾\pi(\bar{a}) = \overline{\pi(a)}.

Step 1: subkeys. The key schedule uses only PC-1, left circular shifts and PC-2. These move or select bits. Thus the key Kˉ\bar{K} gives the subkeys Kˉ1,…,Kˉ16\bar{K}_1, \dots, \bar{K}_{16}.

Step 2: the round function. F(R,Ki)=P(S(E(R)⊕Ki))F(R, K_i) = P(S(E(R) \oplus K_i)). The expansion EE copies bits, so E(Rˉ)=E(R)‾E(\bar{R}) = \overline{E(R)}. Then:

E(Rˉ)⊕Kˉi=E(R)‾⊕Kˉi=E(R)⊕KiE(\bar{R}) \oplus \bar{K}_i = \overline{E(R)} \oplus \bar{K}_i = E(R) \oplus K_i

The S-boxes get the same input. Thus F(Rˉ,Kˉi)=F(R,Ki)F(\bar{R}, \bar{K}_i) = F(R, K_i).

Step 3: initial permutation. IP(xˉ)=IP(x)‾IP(\bar{x}) = \overline{IP(x)}. Thus the second run starts with Lˉ0\bar{L}_0 and Rˉ0\bar{R}_0.

Step 4: induction over the rounds. Assume the second run has Lˉi−1\bar{L}_{i-1} and Rˉi−1\bar{R}_{i-1} after round i−1i-1. Then:

Li′=Rˉi−1=Lˉi,Ri′=Lˉi−1⊕F(Rˉi−1,Kˉi)=Lˉi−1⊕F(Ri−1,Ki)=Ri‾L'_i = \bar{R}_{i-1} = \bar{L}_i, \qquad R'_i = \bar{L}_{i-1} \oplus F(\bar{R}_{i-1}, \bar{K}_i) = \bar{L}_{i-1} \oplus F(R_{i-1}, K_i) = \overline{R_i}

Thus every round keeps the complement relation, up to round 16.

Step 5: output. The 32-bit swap and IP−1IP^{-1} are permutations. Thus y′=IP−1(Rˉ16∥Lˉ16)=y‾y' = IP^{-1}(\bar{R}_{16} \Vert \bar{L}_{16}) = \overline{y}. ■\blacksquare

Result: a brute-force search on DES needs only 2552^{55} trials instead of 2562^{56}. One encryption tests both KK and Kˉ\bar{K}.

E8. TLS or IPSec for e-commerceSearch on YouTube

Exam: End-sem. Marks: 20 (4 parts x 5).

Question. An e-commerce company launches a new online payment system. It must protect customer login, credit card transactions, session cookies, and API requests between the mobile app and the server. The developer asks: is HTTPS (TLS 1.3) enough, or is an additional IPSec configuration necessary? (a) How does SSL/TLS protect each component? (b) Why is TLS preferred over IPSec for e-commerce? (c) Give a situation where IPSec is still necessary in the same company. (d) What can go wrong if SSL certificates are misconfigured (self-signed certificate, weak ciphers, expired certificates)?

Answer (a). TLS first runs the handshake. The server proves its identity with its X.509 certificate. Then the two sides agree on session keys. After that, the record protocol encrypts each record and adds a MAC (in TLS 1.3, an AEAD cipher such as AES-GCM).

ComponentHow TLS protects it
Customer loginThe username and password go inside the encrypted channel. The certificate proves that the site is real, which stops phishing by a fake server and man-in-the-middle attacks.
Credit card transactionsEncryption gives confidentiality. The MAC gives integrity, so nobody can change the amount. Sequence numbers stop replay.
Session cookiesThe cookies travel only inside TLS. Set the Secure flag (send only over HTTPS) and HttpOnly. Add HSTS so the browser never uses plain HTTP. This stops session hijacking by sniffing.
API requests (app to server)The app uses HTTPS for every call. Optional certificate pinning in the app stops a man-in-the-middle with a fake certificate.

Answer (b). TLS is preferred for these reasons:

  1. TLS works at the transport layer, inside the application. It needs no change to the operating system or the network.
  2. Every browser and phone already supports TLS. Customers need no setup. IPSec needs a configured client on each device.
  3. TLS authenticates the server to the user with a certificate. IPSec authenticates hosts or networks, not a web site.
  4. TLS protects one application session end to end. This is exactly the client-to-web-server traffic of e-commerce.
  5. TLS 1.3 has a fast handshake (one round trip) and passes easily through NAT and firewalls.

Answer (c). IPSec works at the IP layer and protects all traffic between two hosts or networks. Examples in the same company:

  • A site-to-site VPN in tunnel mode between the head office, the data center and the payment processor or bank.
  • Remote access VPN for employees and administrators who manage the servers.
  • Protection of internal traffic between the web servers and the database servers, also for protocols that do not use TLS.
  • PCI-DSS requirements for encrypted links between internal networks.

Answer (d).

MisconfigurationResult
Self-signed certificateNo trusted CA signed it. Browsers show a warning. Users learn to click through warnings, so a man-in-the-middle with a fake certificate becomes easy.
Weak ciphers or old versions (RC4, DES, export ciphers, SSL 3.0, TLS 1.0)Attackers can downgrade the connection or break the encryption (for example POODLE, BEAST, FREAK). Card data can leak.
Expired certificateBrowsers block or warn. Customers lose trust and the business loses sales. API clients can fail or, if checks are disabled, accept fake servers.
Wrong host name or incomplete chainValidation fails on some clients. Developers often disable validation to "fix" it, which removes all authentication.
Leaked private keyAn attacker can impersonate the server. Without forward secrecy, the attacker can also decrypt recorded traffic.

Conclusion. TLS 1.3, correctly configured, is enough for the customer-facing parts. Use IPSec in addition for the internal and partner network links.