Cyber and info security can feel like a bag of unrelated terms: CIA triad, RSA, hashes, certificates and firewalls. Questions ask you to connect a goal to its mechanism or calculate a result. They are one system: encryption serves confidentiality, hashes serve integrity, signatures serve non-repudiation, and both RSA and Diffie-Hellman reduce to modular arithmetic small enough to finish on paper.
1. What cyber and info security actually protects
The CIA triad has three goals:
Confidentiality: only the intended party can read the data. Use encryption.
Integrity: the data has not been altered. Hashes and message-authentication codes detect changes.
Availability: the service remains reachable. Redundancy and denial-of-service defences support it.
Authentication establishes identity. Non-repudiation prevents a sender from credibly denying a message later, and digital signatures provide it.
A passive attack observes without changing communication through eavesdropping or traffic analysis. It leaves no trace to alarm on, so the defence has to be prevention rather than response: encryption limits what an eavesdropper can actually read. An active attack modifies or disrupts communication through masquerade, replay, alteration or denial of service. It requires detection and recovery as well as prevention.
2. Symmetric vs asymmetric cryptography
Symmetric cryptography uses the same secret key for encryption and decryption. It is fast for bulk data. DES has a 56-bit effective key; AES supports 128, 192 and 256-bit keys. The weakness is distribution: both parties need the shared key first.
Asymmetric cryptography gives each user a public and private key. Encrypt confidential data with the receiver's public key; decrypt with their private key. RSA is the standard example. These operations are slower, so systems use them mainly for key establishment and signatures.
With 100 users, symmetric communication needs one key per pair:
n(n - 1) / 2 = 100 x 99 / 2 = 9,900 / 2 = 4,950 keys.
Asymmetric cryptography needs one public and one private key per user:
2n = 2 x 100 = 200 keys.
3. RSA worked end to end
Choose p = 3 and q = 11.
n = p x q = 3 x 11 = 33.phi(n) = (p - 1)(q - 1) = 2 x 10 = 20.Choose
e = 7, since1 < 7 < 20andgcd(7, 20) = 1.Find
d, the inverse ofemodulo 20. Since7 x 3 = 21 = 20 + 1,d = 3.
Public key: (e, n) = (7, 33). Private key: (d, n) = (3, 33).
Now encrypt M = 2:
C = M^e mod n = 2^7 mod 33 = 128 mod 33 = 29, because 128 = 3 x 33 + 29.
Decrypt the ciphertext:
M = C^d mod n = 29^3 mod 33. First, 29^2 = 841 = 25 x 33 + 16. Then 16 x 29 = 464 = 14 x 33 + 2. The recovered message is 2.
Three traps matter. e is coprime to phi(n), not necessarily to n. The value d is the inverse of e modulo phi(n), not modulo n. RSA security relies on factoring large n being hard.

4. Diffie-Hellman key exchange
Diffie-Hellman lets two parties agree on a secret while an eavesdropper watches. They publish p and g, but keep their exponents private.
Take p = 23 and g = 5. Alice chooses private a = 6 and sends:
A = 5^6 mod 23 = 8, because 5^2 mod 23 = 2, so 5^6 mod 23 = 2^3 = 8.
Bob chooses private b = 15 and sends:
B = 5^15 mod 23 = 19. Since 5^15 = (5^2)^7 x 5, reduce it to 2^7 x 5 mod 23. Now 2^7 mod 23 = 13, and 13 x 5 = 65 mod 23 = 19.
Alice computes B^a mod p = 19^6 mod 23 = 2. Bob computes A^b mod p = 8^15 mod 23 = 2. Both obtain the shared secret 2 = g^(ab) mod p.
An eavesdropper sees p = 23, g = 5, A = 8 and B = 19, but faces the hard discrete-log problem. Plain Diffie-Hellman provides no authentication, so a man-in-the-middle can intervene. Real handshakes add certificates and signatures.

5. Digital signatures, hashes and certificates
A hash maps input to a fixed-length digest: 128 bits for MD5, 160 for SHA-1, 256 for SHA-256. A secure hash is one-way and collision-resistant. It has no key or inverse, so it is not encryption and cannot be decrypted. MD5 and SHA-1 are both collision-broken, so integrity checks and signatures need SHA-256 or stronger. Recomputing the hash and comparing it detects any change.
A digital signature reverses RSA's confidentiality roles. The sender signs with their private key; others verify with their public key. Reuse the keys above for hash h = 2:
S = h^d mod n = 2^3 mod 33 = 8.
Verification gives S^e mod n = 8^7 mod 33 = 2 = h, so the signature is valid.
A certificate binds an identity to a public key, with a Certificate Authority vouching for it. A signature proves message origin and integrity; a certificate proves public-key ownership. That binding blocks Diffie-Hellman key substitution and underlies the browser padlock. HTTPS is HTTP carried over this protected channel on port 443, above the request-response cycle traced in Application Layer Protocols: DNS, HTTP, and email.
6. Firewalls and network defence
A firewall is a policy checkpoint between networks. Packet filtering applies stateless IP, port and protocol rules. Stateful inspection tracks connections. A proxy inspects application traffic. A DMZ separates public services.
Rule | Direction | Protocol | Destination port | Action |
|---|---|---|---|---|
1 | Inbound | TCP | 443 (HTTPS) | Allow |
2 | Inbound | TCP | 80 (HTTP) | Allow |
3 | Inbound | TCP | 23 (Telnet) | Deny |
4 | Inbound | Any | Any | Deny (default) |
Rule order and the final default-deny matter. Subnetting MCQs: 12 Solved IP Addressing Questions drills the addressing layer these rules match on. A firewall is neither antivirus nor an IDS/IPS, which detects or blocks intrusions by signature or anomaly.
7. How GATE and interviews test this
The official GATE Computer Science syllabus lists IP addressing, transport-layer and application-layer protocols under Computer Networks, and does not name cryptography, signatures, certificates or firewalls. Treat that PDF as the authority on scope for the cycle you are sitting. The material still earns your time: university papers set it as a full unit, placement interviews ask it directly, and it is what makes HTTPS and the application layer stop being magic.
Numeric prompts may ask for RSA d, C or M; a Diffie-Hellman shared secret; or pairwise keys for n users. Conceptual questions contrast encryption with signing, passive with active attacks, hashes with encryption, signatures with certificates, and firewall types.
Keep these traps visible:
Check
gcd(e, phi(n)) = 1.Sign with the sender's private key, but encrypt for confidentiality with the receiver's public key.
Never say that a hash is decrypted.
Diffie-Hellman provides a shared secret, not authentication.
A certificate binds an identity to a public key; it is not a message signature.
Use
n(n - 1) / 2for pairwise symmetric keys, notn^2.
For interviews, explain TLS in the order it happens. The server presents a certificate, the client checks the Certificate Authority signature on it, and that yields a public key the client can trust. The authenticated asymmetric step then protects the establishment of a symmetric session key, and fast symmetric encryption carries the actual data. Say why the split exists: asymmetric operations are too slow for bulk traffic, and symmetric keys cannot be distributed safely on their own. Passwords are a separate question, salted and hashed, never stored as plaintext and never encrypted for later recovery.
8. The short version and your next step
Encryption supports confidentiality, hashes support integrity, signatures support origin and non-repudiation, and resilient design supports availability. Symmetric crypto is fast but needs a shared key. RSA eases distribution and enables signatures. Diffie-Hellman establishes a secret but needs authentication. Firewalls enforce boundary policy.
Use GATE Guidance by Sanchit Sir for sequenced Computer Networks study, then the GATE Test Series for timed numericals. The GATE CS Exam Preparation Courses & Test Series category brings the wider shelf together. Next, solve five RSA and five Diffie-Hellman problems, showing every modular step.




