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.
Playfair Cipher (Solved Question)Neso Academy · a full Playfair question solved, like mid-sem M2, 12 min
Mix Column Transformation in AES | Solved ExampleSK Page · MixColumns on one column, solved by hand, 10 min
The RSA Encryption Algorithm (1 of 2: Computing an Example)Eddie Woo · a small RSA example: n, phi(n), e, d, 9 min
RSA Digital Signature Explained | Step-by-Step Numerical Example & VerificationSatish C J · RSA signature numeric example, like end-sem E4, 9 min
Key Management in Cryptography | Symmetric Key Distribution | Needham Schroeder Protocol | KDCT V Nagaraju Technical · symmetric key distribution, KDC and Needham-Schroeder, 16 minQuestion indexSearch on YouTube
The two papers come from the file SEM VII - Batch 2022.pdf. Both papers allow a calculator. Every question is compulsory.
| Exam | Paper | Max marks | Time |
|---|---|---|---|
| Mid-sem | October 2025 (the paper prints the code ICS412) | 50 | 1.5 hours |
| End-sem | November 2025, CSS411 | 100 | 3 hours |
| No. | Question | Marks | Exam | Notes page |
|---|---|---|---|---|
| M1 | RSA private key, encryption and decryption | 5 | Mid-sem | RSA |
| M2 | Playfair decryption | 10 (5 + 5) | Mid-sem | Classical ciphers |
| M3 | AES MixColumns on one column | 15 | Mid-sem | MixColumns |
| M4 | CFB and OFB with 128-bit blocks | 10 | Mid-sem | Block cipher modes |
| M5 | DES, AES or a lightweight cipher for a bank app | 10 | Mid-sem | AES |
| E1 | Active and passive attacks | 15 | End-sem | Introduction |
| E2 | Diffie-Hellman shared key | 10 | End-sem | Diffie-Hellman |
| E3 | Needham-Schroeder session key | 10 | End-sem | Key management |
| E4 | RSA signatures and DSA signatures | 10 | End-sem | Digital signatures |
| E5 | Elliptic curve point check and 3P | 15 (5 + 10) | End-sem | ECC |
| E6 | SHA-1 blocks and padding | 10 | End-sem | SHA |
| E7 | DES complementation property | 10 | End-sem | DES |
| E8 | TLS and IPSec for an e-commerce system | 20 (4 x 5) | End-sem | SSL/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 , , . The message is . Find the private key and do encryption and decryption.
Answer.
- Calculate the modulus: .
- Calculate Euler's totient: .
- Make sure that . This is true, so is valid.
- Find with the extended Euclidean algorithm:
Work back: . Thus .
Check: . The result is correct.
| Key | Value |
|---|---|
| Public key | |
| Private key |
- Encrypt with square-and-multiply. Use :
- Decrypt: . The result is the original message.
To check the decryption quickly, use the Chinese Remainder Theorem. Modulo 19: and , so . Modulo 29, the same method gives .
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.
| S | E | C | U | R |
| I | T | Y | L | A |
| B | D | F | G | H |
| K | M | N | O | P |
| Q | V | W | X | Z |
Answer (b): decryption.
| Digraph | Positions | Rule | Plaintext |
|---|---|---|---|
| VT | Same column 2 | Move up | ME |
| TD | Same column 2 | Move up | ET |
| VT | Same column 2 | Move up | ME |
| IY | Same row 2 | Move left | AT |
| AD | Rectangle | Swap columns | TH |
| UD | Rectangle | Swap columns | EG |
| IY | Same row 2 | Move left | AT |
| UV | Rectangle | Swap columns | EX |
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 (hex). Use the AES MixColumns matrix. Do all arithmetic in . Use bitwise XOR for addition. For multiplication, multiply the polynomials modulo the irreducible polynomial 0x11B.
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.
| Byte | Binary | Shift left | High bit was 1? | byte |
|---|---|---|---|---|
| 63 | 0110 0011 | 1100 0110 | No | C6 |
| FC | 1111 1100 | 1111 1000 | Yes, XOR 1B | E3 |
| AC | 1010 1100 | 0101 1000 | Yes, XOR 1B | 43 |
| 16 | 0001 0110 | 0010 1100 | No | 2C |
Step 2. Multiply by 03 with .
| Byte | byte |
|---|---|
| 63 | |
| FC | |
| AC | |
| 16 |
Step 3. XOR the four products of each row.
Output column: .
Show the intermediate XORs for full marks. For : , then , then .
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 (for example, AES) with key . 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).
- Load the 128-bit IV into the shift register.
- Encrypt the register. XOR the output with the 128-bit plaintext segment. The result is the ciphertext segment.
- Feed the ciphertext segment back into the register for the next stage.
- To decrypt, encrypt the same register values and XOR them with the ciphertext.
In CFB-, only bits (1, 8 or 64) go out each step. The register shifts left by bits and takes in the ciphertext bits.
OFB.
- Encrypt the IV. The output is the first keystream block .
- XOR with the 128-bit plaintext block to get .
- Feed (not the ciphertext) back as the next input.
- To decrypt, make the same keystream and XOR it with the ciphertext.
| Mode | Advantages | Limitations |
|---|---|---|
| CFB | The 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 bits. A bit error propagates for several blocks. |
| OFB | The 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).
| Point | DES | AES | Lightweight cipher |
|---|---|---|---|
| Key size | 56 bits ( keys) | 128, 192 or 256 bits | Often 80 to 128 bits |
| Block size | 64 bits | 128 bits | Often 32 to 64 bits |
| Brute force | Broken. EFF hardware found a key in a few days in 1998 | trials or more: not possible | Lower margin. Made for small devices |
| Status | Withdrawn. Use only as Triple DES in old systems | NIST standard (Rijndael), used in TLS | For sensors, RFID and IoT chips |
| Speed on a phone | Slow in software, and Triple DES is three times slower | Fast. Modern phone CPUs have AES instructions | Fast, but the speed gain is not necessary here |
Reasons:
- Security strength. AES has a large key and a 128-bit block. No practical attack is known against full AES.
- Brute force. A 56-bit DES key is too short. A 128-bit AES key space is far too large to search.
- Device resources. A modern smartphone has enough CPU and memory. Thus a lightweight cipher gives no real advantage. Lightweight ciphers are for constrained devices.
- 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 attack | How it works |
|---|---|
| Release of message contents | The opponent reads the contents of an e-mail, a file transfer or a phone call. |
| Traffic analysis | The 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 attack | How it works |
|---|---|
| Masquerade | One entity pretends to be a different entity. It usually includes another active attack, for example replay of captured authentication data. |
| Replay | The opponent captures a data unit and sends it again later to get an unauthorized effect. |
| Modification of messages | The opponent changes part of a legitimate message, or delays or reorders messages. |
| Denial of service | The 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.
| Point | Passive | Active |
|---|---|---|
| Effect on data | No change | Change or false data |
| Detection | Very difficult | Easier |
| Prevention | Easier (encryption) | Very difficult |
| Security goal attacked | Confidentiality | Integrity, 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 and the primitive root . A chooses the secret . B chooses the secret . Calculate the common secret key on both ends.
Answer.
- A calculates its public key: .
- B calculates its public key: .
- A and B exchange and .
- A calculates .
- B calculates .
The common secret key is . Both values are equal because .
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: with A and with B. A wants a one-time session key to talk to B. and are nonces. is a known function, for example .
| Step | Message | Purpose |
|---|---|---|
| 1 | A → KDC: | A asks for a session key to talk to B. |
| 2 | KDC → A: | Only A can read it. shows that the reply is fresh and matches the request. |
| 3 | A → B: | A forwards the ticket. Only B can read it, and B learns and A's identity. |
| 4 | B → A: | B tests that A has . |
| 5 | A → B: | A proves that it has . This blocks a replay of message 4. |
Example. Alice (A) wants to send a file to Bob (B).
- Alice sends "Alice, Bob, " to the KDC.
- The KDC makes . It sends Alice , "Bob" and , and a ticket for Bob. All of it is encrypted with .
- Alice decrypts the message, checks , and sends the ticket to Bob.
- Bob decrypts the ticket and sends .
- Alice returns . Now both know and encrypt the file with it.
Weakness: if an old 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 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: . Encrypt the hash with the sender's private key: . Send and . The receiver calculates with the public key and compares it with .
DSA (DSS) approach. DSA is a signature-only algorithm. It does not encrypt.
- Global public values: a 160-bit prime , a large prime where divides , and .
- Keys: private , public .
- Sign with a new random for each message:
- Verify:
The signature is valid if .
| Point | RSA signature | DSA signature |
|---|---|---|
| Method | Encrypt the hash with the private key. Verify by decryption and comparison. | Calculate a pair from the hash, the private key and a random . Verify by a test that does not recover the hash. |
| Hard problem | Integer factorization | Discrete logarithm (a variant of ElGamal and Schnorr) |
| Randomness | Deterministic (same message, same signature) | Needs a new secret for each signature. If is used again, the private key leaks. |
| Uses | Signature, encryption and key exchange | Signature only |
| Signature size | Same size as (1024 bits or more) | 320 bits ( and , 160 bits each) |
| Speed | Fast verification (small ) | 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 . The point is . (a) Check whether is on the curve. (b) Find .
Answer (a).
. Thus is not on the curve. (The points on the curve with are and .)
Answer (b). Write that is not on the curve. Then apply the group formulas as the question asks. Use and .
Step 1. Calculate (point doubling):
, because . Thus .
.
Step 2. Calculate (point addition):
, because . Thus .
The formulas give .
The doubling formula uses but not . Thus the arithmetic works, but the result is not a real point of the group because 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:
- Append padding bits: a single 1, then 0s, so that the length is .
- Append the original length as a 64-bit value.
- Split the result into 512-bit blocks .
- Set the 160-bit buffer to the initial value .
- Process each block with the compression function (80 steps). Add the input chaining value to the output: , with addition modulo on each word.
- The last chaining value 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, ..., CVNAnswer (b).
- Message length: bits.
- Full blocks: . Thus there are 163 full blocks, and 192 message bits stay for the last block.
- The last block has room for bits. Thus no extra block is necessary.
- Padding: bits. This is one 1 bit followed by 255 zero bits.
- Length field: 64 bits, with the value 83648.
| Item | Value |
|---|---|
| Total blocks | 164 |
| Message bits in the last block | 192 |
| Padding in the last block | 256 bits (1 then 255 zeros) |
| Length field | 64 bits |
| Last block check |
E7. DES complementation propertySearch on YouTube
Exam: End-sem. Marks: 10.
Question. Let and . Here is the bitwise complement. Prove that . 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 for . Two facts are true for any bit strings and :
Also, a permutation, a selection or an expansion only moves or copies bits. Thus it commutes with the complement: .
Step 1: subkeys. The key schedule uses only PC-1, left circular shifts and PC-2. These move or select bits. Thus the key gives the subkeys .
Step 2: the round function. . The expansion copies bits, so . Then:
The S-boxes get the same input. Thus .
Step 3: initial permutation. . Thus the second run starts with and .
Step 4: induction over the rounds. Assume the second run has and after round . Then:
Thus every round keeps the complement relation, up to round 16.
Step 5: output. The 32-bit swap and are permutations. Thus .
Result: a brute-force search on DES needs only trials instead of . One encryption tests both and .
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).
| Component | How TLS protects it |
|---|---|
| Customer login | The 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 transactions | Encryption gives confidentiality. The MAC gives integrity, so nobody can change the amount. Sequence numbers stop replay. |
| Session cookies | The 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:
- TLS works at the transport layer, inside the application. It needs no change to the operating system or the network.
- Every browser and phone already supports TLS. Customers need no setup. IPSec needs a configured client on each device.
- TLS authenticates the server to the user with a certificate. IPSec authenticates hosts or networks, not a web site.
- TLS protects one application session end to end. This is exactly the client-to-web-server traffic of e-commerce.
- 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).
| Misconfiguration | Result |
|---|---|
| Self-signed certificate | No 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 certificate | Browsers 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 chain | Validation fails on some clients. Developers often disable validation to "fix" it, which removes all authentication. |
| Leaked private key | An 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.