CRYPTOGRAPHY AND NETWORK SECURITY Notes
CRYPTOGRAPHY AND NETWORK SECURITY Notes
Module 1
2. Security Attacks
A security attack is an attempt to compromise the security of a system.
Types of Attacks:
1. Passive Attacks:
o Focus on monitoring and gathering data without modifying it.
o Difficult to detect but do not affect the system's functioning.
o Examples:
▪ Eavesdropping: Listening to private communication.
▪ Traffic Analysis: Observing data patterns, like frequency or size,
to gather insights.
2. Active Attacks:
o Attempt to alter or disrupt data and system resources.
o Easier to detect but cause more damage.
o Examples:
▪ Masquerade: Pretending to be someone else.
▪ Replay: Resending captured data to deceive the receiver.
▪ Modification of Messages: Tampering with the data.
▪ Denial of Service (DoS): Overloading systems to make them
unavailable.
3. Security Services
Security services are measures that ensure secure communication by protecting
data and resources.
Types of Security Services:
1. Confidentiality: Ensures that only authorized parties can access data.
o Example: Encrypting sensitive information during transmission.
2. Authentication: Verifies the identity of users and systems.
o Example: Login credentials.
3. Data Integrity: Ensures data is not altered during transmission.
o Example: Using checksums to detect tampering.
4. Non-repudiation: Prevents parties from denying their actions.
o Example: Digital signatures.
5. Access Control: Restricts unauthorized access to resources.
o Example: Firewalls and access permissions.
4. Security Mechanisms
These are the methods used to achieve security services.
Common Security Mechanisms:
1. Encryption: Encodes data to prevent unauthorized access.
o Example: AES (Advanced Encryption Standard).
2. Digital Signatures: Authenticate the sender and ensure data integrity.
3. Firewalls: Filter incoming and outgoing traffic to block unauthorized access.
4. Intrusion Detection Systems (IDS): Monitor networks to identify potential
threats.
2. Substitution Techniques
These methods replace the characters in plaintext with other characters or
symbols.
Types of Substitution Techniques:
1. Caesar Cipher:
o Shifts the letters by a fixed number.
o Example: Plaintext: ABC, Key: 1 → Ciphertext: BCD
2. Monoalphabetic Cipher:
o Each character in the plaintext is replaced with a different character.
o Example: Plaintext: HELLO → Ciphertext: QEXXE (based on a
substitution table).
3. Playfair Cipher:
o Encrypts digraphs (pairs of letters) using a 5x5 grid of letters.
o Steps:
▪ Create a grid with a keyword (e.g., MONARCHY).
▪ Pair the plaintext letters (e.g., MEET ME → ME ET ME).
▪ Encrypt based on grid positions.
4. Vigenère Cipher:
o A polyalphabetic cipher that uses a keyword to determine the shift
for each letter.
o Example:
▪ Plaintext: ATTACK
▪ Keyword: LEMON
▪ Ciphertext: LXFOPV
3. Transposition Techniques
These methods rearrange the characters of the plaintext without altering the
actual characters.
Types of Transposition Techniques:
1. Rail Fence Cipher:
o Letters are written in a zigzag pattern across multiple rows.
o Example:
▪ Plaintext: ATTACK AT DAWN
▪ Rows:
▪ Ciphertext: ATADWTCKTAN
2. Columnar Transposition Cipher:
o Plaintext is written into rows under column headings (keys) and then
read column by column.
o Example:
▪ Plaintext: ATTACKATDAWN
▪ Key: 3 1 4 2
▪ Arrange in rows:
Key Differences:
• Substitution Techniques: Change the characters.
• Transposition Techniques: Rearrange the characters.
Module 2
1. Block Ciphers
A block cipher is a method of encrypting data in fixed-size blocks, where each
block is processed independently.
Key Features:
• Fixed Block Size: Data is divided into blocks of a specific size (e.g., 64 bits or
128 bits).
• Symmetric Key: A single key is used for both encryption and decryption.
• Secure Transformation: The encryption process involves substitution
(replacing bits) and permutation (rearranging bits).
Example of Block Cipher Process:
• Plaintext: "HELLOALL"
• Block size: 4 characters
• Steps:
1. Divide the plaintext into blocks: [HELL] [OALL].
2. Encrypt each block separately using a key.
5. Modes of Operation
Modes of operation define how block ciphers handle plaintext longer than one
block.
Common Modes:
1. ECB (Electronic Codebook Mode):
o Each block is encrypted independently.
o Advantage: Simple and fast.
o Disadvantage: Repeated plaintext blocks produce repeated
ciphertext blocks.
2. CBC (Cipher Block Chaining Mode):
o Each plaintext block is XORed with the previous ciphertext block
before encryption.
o Advantage: Patterns in plaintext are hidden.
3. CTR (Counter Mode):
o Each block is XORed with an encrypted counter value.
o Advantage: Supports parallel processing for faster encryption.
8. Blowfish
Blowfish is a symmetric block cipher designed to be fast and secure.
Key Features:
• Block Size: 64 bits.
• Key Length: 32 to 448 bits.
• Rounds: 16 rounds.
Steps in Blowfish Encryption:
1. Divide plaintext into 64-bit blocks.
2. Apply 16 rounds of encryption.
o Each round uses key-dependent S-boxes.
o Perform permutations and substitutions.
3. Combine the blocks to produce the ciphertext.
Advantages:
• Free to use.
• Faster than many other encryption algorithms.
RSA Algorithm
The RSA algorithm is one of the most widely used public key cryptosystems. It is
based on the difficulty of factoring large numbers.
Steps in RSA:
1. Key Generation:
1. Choose two large prime numbers, p and q.
.
2. Compute n=p×qn = p \times qn=p×q.
2. Encryption:
3. Decryption:
Key Management
Key management ensures secure creation, distribution, and storage of
cryptographic keys.
Key Management Tasks:
1. Key Generation: Keys should be generated securely using algorithms like
RSA or ECC.
2. Key Distribution: Public keys are distributed openly; private keys must
remain confidential.
3. Key Storage: Keys are stored in secure hardware or software systems.
4. Key Revocation: In case of compromise, keys must be revoked and
replaced.
2. Bob:
o Chooses a private key b.
3. Compute the Shared Secret:
Example:
1. Overview of IP Security
Why Do We Need IPSec?
1. Untrusted Networks: Internet traffic is vulnerable to eavesdropping,
tampering, and spoofing.
2. Secure Communication: Protects sensitive data, such as banking
transactions and corporate communications.
Main Features of IPSec:
• Confidentiality: Encrypts data to prevent unauthorized access.
• Integrity: Ensures that data is not altered during transmission.
• Authentication: Confirms the sender's identity.
• Replay Protection: Prevents attackers from reusing captured packets to
disrupt communication.
3. IP Security Architecture
The architecture of IPSec consists of:
1. Security Protocols:
• Authentication Header (AH): Provides integrity and authentication.
• Encapsulating Security Payload (ESP): Provides confidentiality, integrity,
and authentication.
2. Security Associations (SAs):
• Defines how data is encrypted, authenticated, and transmitted.
3. Key Management:
• Handles the generation, exchange, and management of cryptographic keys.
4. Policy Database:
• Contains rules for applying IPSec to specific types of traffic.
4. Authentication Header (AH)
Authentication Header (AH) ensures the data’s integrity and authenticity but does
NOT provide encryption.
Features of AH:
• Protects against tampering.
• Authenticates the origin of the data.
How It Works:
• Adds a header containing an Integrity Check Value (ICV) to the IP packet.
• The ICV is computed using a shared key and ensures data is untampered.
Example:
• Original IP Packet:
| IP Header | Payload |
• After Adding AH:
| IP Header | AH | Payload |
7. Key Management
Key management is essential to ensure secure and efficient cryptographic
operations.
Two Approaches:
1. Manual Keying:
• Cryptographic keys are manually configured by administrators.
• Disadvantage: Not scalable for large networks.
2. Automated Keying (Internet Key Exchange - IKE):
• Automates the generation, distribution, and management of keys.
System Security
System security involves protecting computers and networks from threats such as
hackers, viruses, and other malicious activities.