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

Updated 10 Nov 20266 min read
Cryptography Fundamentals and Cryptosystems: RSA, Security Goals and Exam Traps

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.

Two-row Caesar cipher diagram shows GATE encoded with secret key k=5 as LFYJ, then decrypted back to GATE, with a warning about security.

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

Worked RSA flow generates keys, encrypts m=8 to c=134, then decrypts 134 back to 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:

  1. 8^2 mod 187=64; 8^4 mod 187=169.

  2. 8^7 mod 187=(169 x 64 x 8) mod 187.

  3. 169 x 64=10,816; 10,816 mod 187=157.

  4. 157 x 8=1,256; 1,256 mod 187=134. Therefore c=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.

Go deeper with the full courseUGC NET Computer Science (Paper 1 + Paper 2)

Keep learning

Discussion