Cryptography Fundamentals and Cryptosystems: RSA, Security Goals and Exam Traps
Build a clean mental model of cryptography, then follow Caesar and toy RSA calculations step by step. The guide also separates encryption, hashing, MACs and signatures.
KnowledgeGate Team
Exam prep & CS education

Encoding, encryption, hashing, message authentication and digital signatures are often treated as interchangeable. Symmetric and asymmetric systems then get reduced to a key-count rule, making definition questions and small modular-arithmetic problems harder than they are. Identify the security goal, secret material, transformation and verification step. Then test the cryptosystem from key generation to recovered plaintext; all toy values below are intentionally insecure.
Security goals define the cryptosystem requirement
Alice sends plaintext M to Bob; encryption makes ciphertext C under a key. Eve observes passively; Mallory attacks actively. The algorithm may be public; the key stays protected.
Goal | Question answered | Suitable primitive | What it does not prove by itself |
|---|---|---|---|
confidentiality | Can an unauthorised party read M? | encryption | that C was not altered |
integrity | Has the data changed? | cryptographic hash inside an authenticated construction, MAC or signature | who changed it |
authentication | Who or what produced the message? | MAC for parties sharing a secret, or digital signature with validated public-key identity | that the sender's device is physically secure |
availability | Can an authorised user obtain the service or data? | backups, redundancy and operational controls | encryption alone does not keep a service online |
accountability or non-repudiation support | Can origin and later verification be evidenced? | digital signatures plus sound identity, key custody, timestamps and process | a signature alone does not settle every legal or human dispute |
Ciphers cannot protect unlocked-device keys, nearby passwords or visible plaintext.
A cryptosystem is a complete set of algorithms and spaces
A cryptosystem defines plaintext space M, ciphertext space C, key space K, key generation Gen, encryption Enc and decryption Dec. Symmetric correctness is Dec_K(Enc_K(m)) = m for every valid message and key. Public-key encryption uses Gen -> (pk, sk) and Dec_sk(Enc_pk(m)) = m. Randomness or a nonce can vary repeated encryption.
Set A=0, B=1, ..., Z=25. GATE is (6, 0, 19, 4). Caesar key k=5 gives c=(m+5) mod 26=(11, 5, 24, 9), or LFYJ. Decrypt with m=(c-5) mod 26; for L, (11-5) mod 26=6=G. This teaches arithmetic, not security. Substitution replaces symbols; transposition reorders them. Encoding follows a public convention, so Base64 is not encryption.

Cryptosystem key relationships: symmetric, asymmetric and hybrid
System | Key relationship | Strength in a design | Main operational problem | Example role |
|---|---|---|---|---|
symmetric encryption | same secret key, or directly related secret material, encrypts and decrypts | efficient bulk-data confidentiality | securely establishing and rotating the shared key | encrypt a stored file or application session |
public-key encryption | public key encrypts and private key decrypts for confidentiality | sender can protect data without a prior shared decryption key | authenticating the public key and using safe parameters or padding | protect a small secret or session key |
hybrid encryption | public-key mechanism establishes or protects a session secret, then symmetric encryption protects data | scalable key establishment plus efficient data encryption | both layers and their binding must be correct | a secure network session |
A block cipher transforms fixed-size blocks and needs a secure mode for longer data. Block size is not key size. A stream design combines plaintext with a generated keystream and must never reuse a nonce or keystream where its construction forbids it.
In a hybrid design, Alice authenticates Bob's public key, establishes fresh K_s, then both use authenticated symmetric encryption. DNS and HTTP is adjacent revision; application protocols and cryptographic layers answer different questions.
Hashes, MACs, signatures and password KDFs have different contracts
Primitive | Secret used? | Output or operation | Main use | Decisive exam clue |
|---|---|---|---|---|
cryptographic hash | no secret | fixed-length digest | fingerprint and change detection inside a sound design | anyone can recompute it |
MAC | shared secret | authentication tag | integrity plus source authentication among secret holders | verifier also knows the signing secret |
digital signature | signer uses private key, verifier uses public key | signature checked against message | public verification of origin and integrity | signing is not encrypting with the private key |
password hashing or KDF | password plus unique salt and deliberate work factor | stored verifier | resist fast guessing and identical-password lookup | salt is stored, not a secret key |
encryption | key plus plaintext gives ciphertext | reversible protection | confidentiality | authorised decryption recovers plaintext |
For applied threat-to-control mapping, replay defence and mobile-layer boundaries, see Cryptography and Digital Security Technologies: Encryption, Hashes, Signatures and Mobile Security. This treatment instead concentrates on formal cryptosystem spaces, correctness equations and modular arithmetic. Hash tables distribute keys and handle collisions through chaining or open addressing; cryptographic hashes seek preimage, second-preimage and collision resistance.
If the channel changes ciphertext 134 to 135, ordinary decryption may return output without detecting tampering. Authenticated encryption binds confidentiality and integrity.
Worked RSA cryptosystem: generate, encrypt 8 and recover 8

Choose primes p=17, q=11. Then n=pq=187 and phi(n)=(p-1)(q-1)=16 x 10=160. Take e=7 since gcd(7,160)=1, and d=23 since 7 x 23=161=1 x 160+1, so ed mod 160=1. The public key is (n=187,e=7); the private exponent is d=23. Practical storage contains more.
Encrypt valid representative m=8:
8^2 mod 187=64;8^4 mod 187=169.8^7 mod 187=(169 x 64 x 8) mod 187.169 x 64=10,816;10,816 mod 187=157.157 x 8=1,256;1,256 mod 187=134. Thereforec=134.
For square-and-multiply, 23=16+4+2+1. The residue ladder is 134^1=134, 134^2 mod 187=4, 134^4 mod 187=16, 134^8 mod 187=69, 134^16 mod 187=86. Selected residues (86 x 16 x 4 x 134) mod 187 reduce to 67, 81, 8. Thus Dec_23(134)=8.
Because ed=1+phi(n), RSA correctness returns the representative. This is not a security proof.
Common cryptography traps and their corrections
Encoding changes representation; encryption enforces keyed confidentiality.
A hash is designed as one-way; decryption reverses encryption.
A checksum may find accidental error; cryptographic integrity addresses adversarial change.
A MAC uses a shared secret; a signature uses a private-public verification relationship.
The private key creates a signature; do not call this private-key encryption.
Encryption alone does not guarantee integrity, authentication or availability.
A public key helps only when its binding to the intended identity is trusted.
Strong cryptography cannot compensate for stolen keys, exposed screens or bypassed physical controls.
For toy RSA, e is coprime to phi(n), and d is its modular inverse. Reduce messages modulo n=187, not phi(n)=160; the totient selects exponents. Real RSA needs large generated primes, validated libraries, secure padding or encoding, and side-channel-resistant handling. Never deploy toy values or raw exponentiation.
How exams test cryptosystems, the short version and next step
Questions match goals to primitives, track keys, distinguish tools, trace Caesar shifts, calculate n and phi(n), test coprimality, perform modular exponentiation, or spot physical failures. Confirm exam-specific syllabus, marks, dates and format in the relevant exam body's current official notice.
Fast checks: (1) Base64 turns bytes into text. (2) Anyone must verify Bob's message using his public key. (3) Can e=8 replace e=7 here? Answers: (1) encoding; (2) digital signature; (3) no, since gcd(8,160)=8. See UGC NET Computer Science Syllabus Areas for the broader map.
The short version: name the goal, secret and verifier. Ciphers are reversible with the right key; hashes are not encryption. A cryptosystem covers key generation, transformation, recovery or verification, and key handling. Here, 8 -> 134 -> 8.
Recompute it for m=5: 5^2 mod 187=25, 5^4 mod 187=64, 5^7 mod 187=(64 x 25 x 5) mod 187=146; 146^23 mod 187=5. Use UGC NET CS Exam Preparation to place cryptography in the broader subject map. Continue concepts with NTA-UGC-NET Paper 2, or move to the NTA UGC NET Paper 2 Test Series for practice.
Keep learning
Network Security Goals, Threats and Attacks MCQs: 12 Solved Questions
Solve 12 network-security MCQs covering confidentiality, integrity, attack types, spoofing, DDoS and protection properties. Every answer has a clear explanation and a link to practise the question again.
Cyber and Info Security in Computer Networks: Complete Guide with Worked RSA and Diffie-Hellman Examples
Build the topic from security goals to firewalls, then hand-calculate RSA encryption, an RSA signature, and a Diffie-Hellman shared secret. Includes exam traps and an interview-ready TLS explanation.
Cryptography and Digital Security Technologies: Encryption, Hashes, Signatures and Mobile Security
Learn what encryption, hashes, MACs and signatures actually guarantee. Follow a full RSA calculation and map layered controls onto a mobile payment path.
Physical Security and Cryptography Basics: Controls, Ciphers and Worked Examples
Connect physical and logical security through Lab L-07. Learn layered controls, calculate residual risk, trace XOR, compare SHA-256 outputs and choose the right primitive.





