0% found this document useful (0 votes)
20 views13 pages

Network Security & Cryptography Overview

important question of nsc

Uploaded by

tharshi2816
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
20 views13 pages

Network Security & Cryptography Overview

important question of nsc

Uploaded by

tharshi2816
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd

ASSIGNMENT 1

NETWORK SECURITY AND CRYPTOGRAPHY


NAME – HARSHITA TRIPATHI SUBJECT-CODE -BCS3702
SECTION- CS49 YEAR/SEM – 4th YEAR/ VII

Section A — Remembering:
1. Definitions (Plaintext, Ciphertext, Key, Steganography)
Ans. Plaintext: the original readable message or data before any encryption
(e.g., "PAYMENT $100").
Ciphertext: the transformed (unreadable) output produced by applying an
encryption algorithm to plaintext using a key (e.g., after AES encryption you get
a binary/hex string).
Key: secret parameter(s) used by the cipher to control transformation. For
symmetric ciphers the same key (or related keys) is used to encrypt/decrypt;
for asymmetric there are a public/private key pair. Security depends on key
secrecy and length.
Steganography: hiding a secret message inside a benign carrier (e.g.,
embedding a message in the least significant bits of an image) so that the
existence of the message is concealed. It differs from encryption (which hides
content but not existence).
2. Differences between passive and active attacks.
Ans. Passive Attacks
• Aim to observe communications without altering them.
• Target: confidentiality (stealing secrets, monitoring activity).
• Examples:
o Eavesdropping on network traffic
o Traffic analysis (learning communication patterns even if content is
encrypted)
• Hard to detect because no modification occurs.
• Countermeasure: strong encryption, traffic padding, secure channels.
Active Attacks
• Aim to modify, disrupt, or inject messages during communication.
• Target: integrity, availability, authenticity.
• Examples:
o Man-in-the-middle (altering data in transit)
o Replay attacks (resending captured messages)
o Impersonation (pretending to be someone else)
• Usually detectable because system behaviour or message consistency is
affected.
• Countermeasure: authentication, digital signatures, checksums,
intrusion detection.
3. Principles of a Feistel structure.
Ans. A Feistel network is a common symmetric block-cipher construction with
these key principles:
1. Split the input block into two halves L0 and R0.
2. Round function F is applied to one half combined with a round subkey;
result is XORed into the other half:
o Li+1 = Ri
o Ri+1 = Li ⊕ F(Ri, Ki)
3. Invertibility: using the same structure (same F and round keys in reverse)
decrypts — the Feistel design guarantees invertibility even if F is not
invertible.
4. Key schedule: round subkeys K1..Kn are derived from the master key.
5. Multiple rounds provide diffusion and confusion; security depends on F,
number of rounds, and key schedule.
6. Examples: DES is a 16-round Feistel cipher.
4. Main modes of operation for block ciphers.
Ans.
• ECB (Electronic Codebook): each block encrypted independently. Simple
but leaks patterns (identical plaintext blocks → identical ciphertext
blocks).
• CBC (Cipher Block Chaining): Ci = E( Pi ⊕ Ci-1 ) with C0 = IV. Hides
patterns; requires IV; decryption needs previous ciphertext block.
• CFB (Cipher Feedback): turns block cipher into a self-synchronizing
stream cipher; useful for streaming.
• OFB (Output Feedback): produces key-stream independent of plaintext
(like a synchronous stream cipher). Errors don’t propagate except as bit
flips.
• CTR (Counter): encrypt counter values to produce a key-stream then XOR
with plaintext — parallelizable, random-access friendly.
Each mode trades off parallelism, error propagation, and
confidentiality/semantic security properties.

Section B — Understanding:
5. How a Transposition Cipher works — example.
Ans. A transposition cipher keeps the plaintext letters but reorders (permutes)
them. Example: Rail Fence cipher (2 rails) with plaintext HELLOWORLD. Write
letters in zig-zag across two rails:
H . L . O . O . L (row 0: positions 0,2,4,6,8)
. E . L . W . R . D (row 1: positions 1,3,5,7,9)
Read row-wise: ciphertext = HLOOL ELWRD → HLOOLELWRD.
Another transposition is columnar transposition: write plaintext in rows under
a numeric key order, then read columns in key order. Decryption reassembles
columns of appropriate lengths and reads row-wise.
Transposition preserves character frequencies (only order changes), so
frequency analysis alone is insufficient to break — but with enough ciphertext
and knowledge of likely language patterns it’s breakable.
6. Flow of DES encryption (block diagram and steps).
Ans. Step-by-Step Flow of DES
1. Input
o Takes a 64-bit plaintext block.
o Key size: 64 bits, but only 56 bits are used (8 bits for parity).
2. Initial Permutation (IP)
o The 64-bit input block is permuted according to a fixed table.
o Rearranges the bits to prepare for processing.
3. Divide into Two Halves
o Split into Left (32 bits) and Right (32 bits).
4. 16 Rounds of Feistel Structure
Each round consists of:
o Expansion (E): Expand 32-bit right half → 48 bits.
o Key Mixing: XOR with a 48-bit round key (derived from the main
key using Permuted Choice 1, 2 and shifting).
o Substitution (S-Boxes): 48 bits → 32 bits using 8 S-boxes.
o Permutation (P): Rearrange the 32 bits.
o XOR: Result is XORed with the left half.
o Swap: Left and Right halves are swapped (except in the final
round).
5. Final Swap
o After 16 rounds, swap the left and right halves.
6. Inverse Initial Permutation (IP⁻¹)
o Apply the inverse of the initial permutation.
o Produces the 64-bit ciphertext.
7. Role of groups, rings, fields in cryptography.
Ans. Group theory: cryptographic operations rely on algebraic groups where
operations are closed and invertible. Example: the multiplicative group modulo
p (ℤ_p^×) is used by Diffie–Hellman and DSA. Group order and generator
properties (cyclic groups) underpin discrete-log hardness.
Rings: RSA arithmetic uses the ring ℤ_n (integers modulo n). In a ring we can
add and multiply; RSA's security relies on modular exponentiation and difficulty
of factoring n = p·q.
Fields: fields (every nonzero element has a multiplicative inverse) are essential
for algorithms that require inverses. AES uses arithmetic in the finite field
GF(2⁸) for its S-box and Mix Columns steps. Elliptic-curve cryptography uses
groups formed by elliptic curve points over finite fields (e.g., GF(p) or GF(2^m)).
8. Differential cryptanalysis — explained simply.
Ans.
• Idea: study how differences in plaintext pairs propagate through the
cipher and produce differences in ciphertexts. Attackers choose pairs of
plaintexts with a fixed XOR difference ΔP (or observe chosen plaintexts)
and analyse resulting ciphertext differences ΔC.
• Mechanism: find high-probability differential characteristics through the
cipher’s round functions (especially S-boxes) — pairs that produce a
desired ΔC with probability noticeably greater than random. Using many
such pairs, the attacker accumulates statistics to deduce likely subkey
bits in some rounds (by guessing and checking which subkey choices
produce the observed differences).
• Requirements: works best if attacker can obtain many chosen plaintexts
(or many plaintext/ciphertext pairs).
• Defences: use stronger S-boxes with low differential probabilities,
increase rounds, use complex key schedules — modern ciphers are
designed to resist known differential trails.
9. Triple DES (3DES) — concept & why introduced.
Ans.
• What: Apply DES three times (commonly in EDE mode) using either two
or three keys: C = E_{K3}( D_{K2}( E_{K1}(P) ) ).
• Why introduced: DES’s 56-bit key became too short (brute force
feasible). Repeating DES increases effective key-size while preserving
existing DES hardware and implementations for backward compatibility.
• Variants:
3-key 3DES: three independent keys (nominal 168-bit key length).
2-key 3DES: use K1, K2, K1 (nominal 112-bit key length) for
efficiency/backwards compatibility.
• Security note: meet-in-the-middle style attacks reduce the naive
effective security; never the less 3DES greatly increased practical
resistance compared to single DES at the time. Today, 3DES is largely
deprecated in favour of AES (better performance, larger block size,
modern design).
Section C — Applying
10. Encrypt CRYPTOGRAPHY with Vigenère key KEY.
Ans. Vigenère uses letter indices A=0 ... Z=25. Key K E Y → shifts 10, 4, 24.
Repeat key to match plaintext length.
Plaintext: C R Y P T O G R A P H Y
Key (repeated): K E Y K E Y K E Y K E Y
Shifts: 10 4 24 ...
Compute each cipher letter: C + K(10) → M, R + E(4) → V, ... (I computed all):
Ciphertext = MVWZXMQVYZLW
11. Demonstrate ECB vs CBC with a tiny numeric toy cipher.
Ans. Use a toy block cipher E(key, block) = (block + key) mod 256 (not secure —
just illustrative). Let plaintext blocks be P1=10, P2=20, P3=30. Key K=5, IV for
CBC = 1.
• ECB (each block independent):
o C1 = E(5,10) = 15
o C2 = E(5,20) = 25
o C3 = E(5,30) = 35
Decrypt: P1 = C1 - 5, etc. Error: corrupting C2 affects only P2.
• CBC (C1 = E(K, P1 ⊕ IV), Ci = E(K, Pi ⊕ Ci-1)):
o C1 = E(5, 10 ⊕ 1 = 11) = 16
o C2 = E(5, 20 ⊕ 16 = 4) = 9
o C3 = E(5, 30 ⊕ 9 = 23) = 28
Decrypt: P1 = D(K,C1) ⊕ IV etc. Error propagation: corrupt C1 will
garble P1 and flip corresponding bits in P2 (since decryption of C2
XORs C1).
Takeaway: ECB is parallelizable but leaks identical-block patterns; CBC hides
patterns but links blocks and has different error propagation behaviour and
requires an unpredictable IV.
12. Encrypt SECURITY with Rail Fence cipher — 2 rails.
Ans. For 2 rails, write characters alternating across two rows:
Positions: 0 S, 1 E, 2 C, 3 U, 4 R, 5 I, 6 T, 7 Y
• Rail 0 (even positions 0,2,4,6): S C R T → "SCRT"
• Rail 1: E U I Y → "EUIY"
Ciphertext = Rail0 + Rail1 = SCRTEUIY.
Decryption: knowing 2 rails, split ciphertext into first ceil(n/2) and remaining
characters and read zigzag to reconstruct.

Section D — Analyzing
13. Substitution vs Transposition ciphers — comparison with examples.
Ans. Substitution: each plaintext symbol replaced by another (Caesar shift,
monoalphabetic). Example: Caesar with shift 3: A→D.
• Strengths: simple; can mask individual letters.
• Weaknesses: preserves position frequencies → vulnerable to frequency
analysis.
Transposition: characters are permuted but their identities remain (rail fence,
columnar). Example: HELLO → H L O L E (depending on scheme).
• Strengths: preserves frequency distribution making frequency analysis
less useful; can be combined with substitution for added strength.
• Weaknesses: alone it can be broken by trying likely word patterns and
column-length trials.
Combined approach (product ciphers) is stronger because substitution
obscures identity while transposition spreads patterns — modern ciphers
combine both ideas (substitution boxes + permutations).
14. Weaknesses of classical ciphers in the modern era.
Ans. Small key space: DES (56-bit) is brute-forced today.
Statistical vulnerabilities: monoalphabetic substitution leaks character
frequencies.
Lack of formal design: they often lack proofs or resistance guarantees vs
modern cryptanalysis (differential/linear).
Lack of integrity/authentication: do not provide message authenticity; easy to
tamper with ciphertext without detection.
Small block sizes: 64-bit blocks (DES/3DES) are susceptible to birthday
collisions with high-volume data.
No resistance to adaptive attacks: Many classical schemes fail under chosen-
plaintext/ciphertext models that modern attackers can mount.
=> Result: classical ciphers are insecure for modern threat models and large-
scale data; modern constructions (AES, authenticated encryption) are used
instead.
15. Why Shannon’s confusion and diffusion are critical in block ciphers.
Ans. Confusion: make relationship between key and ciphertext complex (so
that changing key alters ciphertext in a complex, non-linear way). Achieved by
nonlinear substitution (S-boxes).
Diffusion: spread the plaintext influence across many ciphertext bits (so a small
change in plaintext affects many ciphertext bits). Achieved by
permutations/mixing (P-permutations, Mix Columns).
Together they prevent simple statistical relationships: confusion resists key
recovery by hiding linear relations; diffusion ensures plaintext statistics are
smeared across ciphertext, defeating frequency-based attacks. Modern cipher
design (rounds of substitution + permutation) explicitly targets these two goals.
16. ECB, CBC, CFB — error propagation differences.
Ans.
• ECB: corruption of ciphertext block Ci affects only decrypted plaintext Pi
— no propagation to other blocks. Minimal error propagation.
• CBC: corrupting Ci during transmission causes:
Pi (decrypted from Ci) to be completely garbled (since Dec(Ci) is
wrong), and
Pi+1 to have some bits flipped (because Pi+1 = Dec(Ci+1) ⊕
Ci) — so the corruption affects two blocks (one full, one with bit flips).
• CFB (depending on feedback size): a corrupted ciphertext segment may
cause corrupted plaintext for a short window until the feedback shifts
out; error propagation length equals the feedback register effect. For
full-block CFB, a corrupted Ci affects Pi (garbled) and a limited effect on
following blocks until resynchronization.
17. Why brute-force is feasible for DES but harder for AES.
Ans. DES key size = 56 bits. 256 brute force is within reach of well-resourced
attackers and specialized hardware (practical since the 1990s). Parallel and
hardware implementations (FPGAs, ASICs) further reduce time.
AES supports 128, 192, 256-bit keys. Brute-force complexity (2128 etc.) is
currently infeasible.
Other factors: DES’s small block size (64 bits) and older structure make some
attacks practical; AES’s modern design, larger key and block sizes, and strong
resistance to known cryptanalysis make brute-force the only realistic attack for
well-implemented AES.
Caveat: side-channel attacks, poor key management, or implementation bugs
can break either cipher regardless of key size. But from pure brute-force
perspective, AES is orders of magnitude stronger than DES.

Section E — Evaluating
18. Critically evaluate Triple DES security today.
Ans. Pros when introduced: increased resistance to brute force over single
DES, backward compatibility.
Cons today:
• Performance: slow compared to AES (three DES operations per block).
• Block size: 64-bit block → vulnerable to birthday-bound collisions for
high throughput (practical in some high-volume systems).
• Effective security: three-key 3DES’s naive 168-bit nominal key is reduced
in practice (meet-in-the-middle) to an effective security on the order of
~112 bits; two-key 3DES is weaker.
• Standards: many standards and vendors have deprecated 3DES (NIST has
moved to disallow or phase it out for some uses).
Conclusion: 3DES is legacy; for new systems use AES (128/256) with
authenticated modes (GCM/CCM) and migrate legacy 3DES deployments
where possible.
19. Advantages and disadvantages: symmetric key vs asymmetric key
cryptography.
Ans. Symmetric (shared secret):
• Advantages: fast (bulk encryption), low computational cost,
efficient for large volumes.
• Disadvantages: key distribution/scalability — securely
sharing/rotating keys with many parties is hard; no native non-
repudiation or public verification.
Asymmetric (public/private key):
• Advantages: solves key distribution (public keys can be posted),
supports digital signatures, enables key exchange (Diffie–Hellman,
RSA-based key wrap).
• Disadvantages: slow (computationally heavy), not suitable for bulk
encryption alone; larger key sizes and slower operations.
20. Can steganography replace encryption in practice?
Ans. Steganography cannot replace encryption in practice because both serve
different purposes. Encryption transforms plain data into unreadable
ciphertext, ensuring confidentiality even if the message is intercepted. On the
other hand, steganography conceals the very existence of the message by
hiding it in media such as images, audio, or video files. If hidden data is
discovered in steganography, it can be directly read without additional
protection, unlike encryption which requires a secret key. Thus, steganography
alone is weak for secure communication. Encryption, being mathematically
strong and standardized, is widely used in banking, online communication, and
data protection. Steganography is mainly useful for covert communication or
digital watermarking where secrecy of existence is important. In practice, both
techniques complement each other rather than replace one another. The most
secure approach is to encrypt sensitive data first and then embed it using
steganography. This ensures both confidentiality and concealment. Therefore,
steganography cannot be a substitute for encryption but can strengthen
security when used together.
21. Why modular arithmetic is fundamental in cryptographic algorithms.
Ans.

• Finite structure: modular arithmetic gives a finite set of residues with


well-understood algebraic properties (closure, associativity, identity,
inverses when they exist).
• Invertible operations: modular multiplication/exponentiation allow
constructing one-way functions with trapdoor properties (e.g., x^e mod
n reversible only with private key in RSA).
• Useful theorems: Euler’s theorem, Fermat’s little theorem, CRT
(Chinese Remainder Theorem) enable efficient exponentiation and
decryption optimizations (CRT accelerates RSA decryption).
• Discrete log hardness: in groups like Z_p^× or elliptic curve groups, the
discrete logarithm problem is computationally hard, forming basis for
Diffie–Hellman, DSA, and ECC.
• Finite field arithmetic (mod 2^n or GF(2^m)) is used in symmetric
ciphers (AES uses GF(2^8) operations for nonlinear S-boxes and Mix
Columns).

Because cryptographic hardness often relies on number-theoretic


properties, modular arithmetic is a natural and fundamental toolkit.

22. Impact of key size on security and performance of block ciphers.

Ans. Security: larger keys increase brute-force resistance exponentially (e.g.,


128 vs 256 bits), strengthening against future increases in attacker compute
power. However, effective security also depends on algorithmic design and
vulnerability to non-brute attacks.

Performance: larger keys can slightly increase key schedule cost, memory for
storing keys, and possibly setup time (negligible for many modern designs). For
constrained devices, larger keys mean more CPU cycles for key expansion or
signing operations (notably in asymmetric crypto).

Diminishing returns: beyond a point (e.g., going from 256 to 512 bits in
symmetric keys) there is little practical benefit while cost increases. For
symmetric ciphers, 128 bits is currently considered secure for most uses; 256-
bit keys are chosen for long-term confidentiality or defense-in-depth. For
asymmetric crypto, larger keys affect performance more strongly (RSA
3072/4096 bits vs ECC 256/384 bits).
Block size interplay: security against message collisions depends on block size
(birthday paradox). Small block sizes (e.g., 64-bit) risk collisions with high
volumes; larger block sizes reduce this risk.

Recommendation: choose key sizes per standards and threat model (AES-128
or AES-256 for symmetric; ECC 256/384 for public-key needs, RSA sized per
required security level).

You might also like