CSS Prepare

optional · CSS study notes

Encryption Algorithms (DES, RSA)

  • DES (Data Encryption Standard): a symmetric-key block cipher (same key for encryption/decryption), 56-bit effective key length — now considered insecure/outdated due to short key length, superseded by AES
  • RSA: an asymmetric-key (public-key) algorithm — uses a public key to encrypt and a mathematically related private key to decrypt, based on the computational difficulty of factoring large prime products — widely used for secure key exchange and digital signatures

MCQ Trap

  • DES is symmetric (one shared key); RSA is asymmetric (public/private key pair).

📌 Sample & Repeated FPSC Questions (2016–2026)

📝 DES vs AES vs RSA — Direct Comparison

2022, Paper I, Q6(b) (8 marks) — Compare and contrast the DES, AES, and RSA encryption algorithms.

  • DES (Data Encryption Standard): symmetric block cipher, 56-bit key, 64-bit blocks, 16-round Feistel structure. Now insecure — its small key space is vulnerable to brute force; largely superseded (3DES extended its life).
  • AES (Advanced Encryption Standard): modern symmetric block cipher, 128-bit blocks, key sizes of 128/192/256 bits, substitution-permutation network rounds. Fast, efficient in hardware and software, currently the de facto standard for bulk data encryption.
  • RSA: asymmetric (public-key) algorithm based on the difficulty of factoring large numbers. Public key encrypts, private key decrypts (or vice versa for signatures); typical key sizes ≥ 2048 bits.

Key differences: DES and AES are symmetric — the same secret key encrypts and decrypts, so it must be shared securely. RSA is asymmetric — the public key can be shared openly, only the private key stays secret. Symmetric ciphers are far faster and used for bulk data; RSA is computationally expensive and typically reserved for key exchange and digital signatures, or to encrypt a symmetric session key in hybrid encryption schemes.

📝 A Frequently Repeated Question — Website Encryption Mechanisms

2021, Paper II, Q8(c) (6 marks) / 2025, Paper II, Q8(b) (6 marks) — What are different security mechanisms used for encrypting the contents of a website? Explain one in detail. (Near-identical wording tested in both 2021 and 2025 — a genuinely repeated FPSC question worth memorizing.)

Mechanisms: SSL/TLS (HTTPS) for data in transit; symmetric encryption (AES) for data at rest; asymmetric encryption (RSA/ECC) for key exchange and digital signatures/certificates; password hashing with salt (bcrypt, SHA-256) for stored credentials; Web Application Firewalls for filtering malicious traffic.

Detailed: TLS/HTTPS handshake — (1) client and server negotiate a cipher suite; (2) server presents a digital certificate containing its public key, signed by a trusted Certificate Authority; (3) the client verifies the certificate, then — using asymmetric cryptography (RSA or ECDHE) — the two sides securely agree on a shared, temporary symmetric session key without ever transmitting it in the clear; (4) all subsequent traffic is encrypted with this fast symmetric key (e.g., AES-GCM), with integrity verified via a MAC/AEAD tag.

Key reasoning points:

  • This is the single clearest real-world illustration of why both symmetric and asymmetric encryption exist together: RSA/ECDHE (asymmetric, slow, good for key exchange) hands off to AES (symmetric, fast, good for bulk data) — exactly the DES/AES-vs-RSA distinction above, applied in practice.
  • MCQ Trap: TLS does not use RSA (or any asymmetric cipher) to encrypt the actual page content — only to establish/exchange the symmetric session key. Bulk encryption is always symmetric for performance reasons.

📜 Past-Paper Questions & MCQs (CSS 2016–2026)

2022 · Paper-I · Q6(b) · 8 marks

Q. Compare and contrast the DES, AES and RSA encryption algorithms.

Ans.

BasisDESAESRSA
TypeSymmetric block cipher (Feistel)Symmetric block cipher (substitution-permutation)Asymmetric (public-key)
Block size64 bits128 bitsMessage is below the key size (2048+ bits)
Key size56 bits effective (64 with parity)128, 192 or 256 bits2048 bits or more
Rounds16 (48-bit round keys)10, 12 or 14None (modular exponentiation)
KeysOne shared secret keyOne shared secret keyPublic key to encrypt, private key to decrypt
SecurityWeak today (brute-forced), replaced by AESStrong, the current standardStrong, based on the difficulty of factoring large primes
Speed and useFast, now obsoleteVery fast, bulk data encryptionSlow, used for key exchange and digital signatures
  • In practice: RSA exchanges a session key securely, and AES then encrypts the data (as in TLS).

MCQs

2026 P-II · Q9. The Data Encryption Standard (DES) generates bit round keys.

  • (A) 16
  • (B) 32
  • (C) 48 ✅
  • (D) None of these
  • Answer: (C) 48.
  • Why: DES has a 56-bit key and 16 rounds. From it, a 48-bit subkey is chosen for each round. (16 is the number of rounds, not the key size.)

2026 P-II · Q10. In symmetric key cryptography, the sender and the receiver use __ keys.

  • (A) Shared ✅
  • (B) Two
  • (C) No
  • (D) None of these
  • Answer: (A) Shared.
  • Why: symmetric encryption uses one secret key that both sides know. Two keys (public and private) are used in asymmetric cryptography.