0% found this document useful (0 votes)
32 views33 pages

Cns Sem 1

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

Cns Sem 1

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

Unit 1

1) Explain any two ciphers from each substitution and


transposition symmetric key ciphers
A) Two ciphers from each category: substitution and transposition
symmetric key ciphers.
Substitution Ciphers
Substitution ciphers work by replacing each element of the
plaintext with another element.
1. **Caesar Cipher**:
- **Description**: The Caesar cipher is one of the simplest and
most well-known encryption techniques. Named after Julius
Caesar, who reportedly used it to communicate with his officials,
it involves shifting each letter in the plaintext by a fixed number of
positions down or up the alphabet.
- **Example**: With a shift of 3:
- Plaintext: "HELLO"
- Ciphertext: "KHOOR"
- Here, 'H' is shifted to 'K', 'E' to 'H', 'L' to 'O', and 'O' to 'R'.
2. **Vigenère Cipher**:
- **Description**: The Vigenère cipher is a method of
encrypting alphabetic text by using a simple form of
polyalphabetic substitution. It uses a keyword, where each letter
of the keyword refers to a shift in the Caesar cipher applied to the
plaintext.
- **Example**: With a keyword "KEY":
- Plaintext: "HELLO"
- Keyword: "KEYKE" (repeated to match the length of the
plaintext)
- Ciphertext: "RIJVS"
- Here, 'H' shifted by 'K' (10 positions) becomes 'R', 'E' shifted
by 'E' (4 positions) becomes 'I', and so on.
### Transposition Ciphers
Transposition ciphers work by rearranging the elements of the
plaintext according to some fixed system, without changing the
actual elements themselves.
1. **Rail Fence Cipher**:
- **Description**: The Rail Fence cipher is a form of
transposition cipher where the plaintext is written in a zigzag
pattern across multiple "rails" (rows) and then read off row by
row.
- **Example**: With 3 rails:
- Plaintext: "HELLO WORLD"
- Written in rails:
H...O...R...
.E.L.W.L.D..
..L...O....
- Ciphertext: "HO RED LWLDLO"

2. **Columnar Transposition Cipher**:


- **Description**: This cipher involves writing the plaintext in
rows of a fixed length and then permuting the columns according
to some key. The key determines the order in which the columns
are read to generate the ciphertext.
- **Example**: With key "3124" and plaintext "HELLO WORLD":
- Plaintext written in columns:
3124
--------
HELL
OWOR
LD
- Read columns in the order of the key: 3, 1, 2, 4:
- Column 3: "L O"
- Column 1: "H O L"
- Column 2: "E W D"
- Column 4: "L R"
- Ciphertext: "LO HOL EWD LR"
Each of these ciphers provides a different approach to encrypting
information, with substitution ciphers focusing on replacing
elements and transposition ciphers focusing on rearranging them.

2) Explain different types of cryptanalytic attacks


A) Cryptanalytic attacks are strategies for decrypting ciphertext
without access to the key. Here are different types of
cryptanalytic attacks:
### 1. **Brute Force Attack**
- **Description**: Involves trying all possible keys until the
correct one is found.
- **Advantage**: Guaranteed to find the key eventually.
- **Disadvantage**: Time-consuming and computationally
expensive, especially with large key spaces.
### 2. **Known Plaintext Attack**
- **Description**: The attacker has access to both the plaintext
and its corresponding ciphertext.
- **Objective**: To determine the key or the encryption
algorithm used.
- **Example**: If an attacker knows the plaintext "HELLO"
corresponds to the ciphertext "KHOOR" in a Caesar cipher, they
can deduce the shift key used.
### 3. **Chosen Plaintext Attack**
- **Description**: The attacker can choose arbitrary plaintexts to
be encrypted and then obtains the corresponding ciphertexts.
- **Objective**: To deduce the key or the internal structure of the
cipher.
- **Example**: Feeding specific inputs to a system and analyzing
the outputs to infer the encryption key.
### 4. **Ciphertext-Only Attack**
- **Description**: The attacker has only the ciphertext and no
information about the plaintext or the key.
- **Objective**: To deduce the plaintext or the key by analyzing
the ciphertext.
- **Example**: Frequency analysis on a substitution cipher to
deduce the most common letters and infer the plaintext.
### 5. **Differential Cryptanalysis**
- **Description**: A method used primarily against block ciphers.
It studies how differences in plaintexts can affect the differences
in the resulting ciphertexts.
- **Objective**: To find patterns or correlations that can be
exploited to deduce the key.
- **Example**: Applying specific input differences to a cipher and
analyzing the output differences to uncover the key.
### 6. **Linear Cryptanalysis**
- **Description**: Also used against block ciphers. It uses linear
approximations to describe the behavior of the block cipher.
- **Objective**: To find a linear relationship between the
plaintext, ciphertext, and key bits.
- **Example**: Constructing linear equations based on known
plaintext-ciphertext pairs to solve for the key bits.
### 7. **Side-Channel Attacks**
- **Description**: Exploits physical implementations of a
cryptosystem rather than theoretical weaknesses in the
algorithms.
- **Objective**: To gather information that can lead to the
discovery of the key.
- **Example**: Measuring the power consumption of a smart
card during a cryptographic operation to deduce the key.
8. **Man-in-the-Middle Attack**
- **Description**: The attacker intercepts and possibly alters the
communication between two parties without their knowledge.
- **Objective**: To decrypt, alter, or inject messages in the
communication.
- **Example**: An attacker intercepting and modifying the Diffie-
Hellman key exchange process to establish keys with both
communicating parties and decrypt the messages.

3) Explain in detail about DES encryption and decryption with


neat sketch

A) The Data Encryption Standard (DES) is a


symmetric-key block cipher published by the
National Institute of Standards and Technology
(NIST).
DES is an implementation of a Feistel Cipher. It uses
16 round Feistel structure. The block size is 64-bit.
Though, key length is 64-bit, DES has an effective
key length of 56 bits, since 8 of the 64 bits of the
key are not used by the encryption algorithm
(function as check bits only). General Structure of
DES is depicted in the following illustration −
Since DES is based on the Feistel Cipher, all that is
required to specify DES is −
 Round function
 Key schedule
 Any additional processing − Initial and final
permutation
Initial and Final Permutation
The initial and final permutations are straight
Permutation boxes (P-boxes) that are inverses of
each other. They have no cryptography significance
in DES. The initial and final permutations are shown
as follows −
Round Function
The heart of this cipher is the DES function, f. The
DES function applies a 48-bit key to the rightmost
32 bits to produce a 32-bit output.

 Expansion Permutation Box − Since right input is


32-bit and round key is a 48-bit, we first need to
expand right input to 48 bits. Permutation logic
is graphically depicted in the following illustration

 The graphically depicted permutation logic is


generally described as table in DES specification
illustrated as shown −

 XOR (Whitener). − After the expansion


permutation, DES does XOR operation on the
expanded right section and the round key. The
round key is used only in this operation.
 Substitution Boxes. − The S-boxes carry out the
real mixing (confusion). DES uses 8 S-boxes,
each with a 6-bit input and a 4-bit output. Refer
the following illustration
 Key Generation
 The round-key generator creates sixteen 48-bit
keys out of a 56-bit cipher key. The process of
key generation is depicted in the following
illustration −

4) Explain in detail about AES encryption and decryption with


neat sketch
A) The more popular and widely adopted symmetric
encryption algorithm likely to be encountered
nowadays is the Advanced Encryption Standard
(AES). It is found at least six time faster than triple
DES.
A replacement for DES was needed as its key size
was too small. With increasing computing power, it
was considered vulnerable against exhaustive key
search attack. Triple DES was designed to overcome
this drawback but it was found slow.
he features of AES are as follows −
 Symmetric key symmetric block cipher
 128-bit data, 128/192/256-bit keys
 Stronger and faster than Triple-DES
 Provide full specification and design details
 Software implementable in C and Java
Operation of AES
AES is an iterative rather than Feistel cipher. It is
based on ‘substitution–permutation network’. It
comprises of a series of linked operations, some of
which involve replacing inputs by specific outputs
(substitutions) and others involve shuffling bits
around (permutations).
Interestingly, AES performs all its computations on
bytes rather than bits. Hence, AES treats the 128
bits of a plaintext block as 16 bytes. These 16 bytes
are arranged in four columns and four rows for
processing as a matrix −
Unlike DES, the number of rounds in AES is variable
and depends on the length of the key. AES uses 10
rounds for 128-bit keys, 12 rounds for 192-bit keys
and 14 rounds for 256-bit keys. Each of these
rounds uses a different 128-bit round key, which is
calculated from the original AES key.
AES Analysis
In present day cryptography, AES is widely adopted
and supported in both hardware and software. Till
date, no practical cryptanalytic attacks against AES
has been discovered. Additionally, AES has built-in
flexibility of key length, which allows a degree of
‘future-proofing’ against progress in the ability to
perform exhaustive key searches.
However, just as for DES, the AES security is
assured only if it is correctly implemented and good
key management is employed.

5) Describe RSA algorithm? Perform encryption/decryption


using RSA algorithm with instances: p=3; q=11, e=7; m=5
A) RSA Algorithm Overview
The RSA (Rivest-Shamir-Adleman) algorithm is a widely used
public-key cryptosystem that enables secure data transmission.
RSA involves key generation, encryption, and decryption
processes.
RSA Algorithm Overview
The RSA (Rivest-Shamir-Adleman) algorithm is a widely used
public-key cryptosystem that enables secure data transmission.
RSA involves key generation, encryption, and decryption
processes.
Key Generation
1. Select two distinct prime numbers p and q.
2. Compute n=pq is used as the modulus for both the public
and private keys.
3. Compute ϕ(n)=(p−1)(q−1) where is Euler's totient function.
4. Choose an integer e such that 1<e<ϕ(n) and e is co-prime
with ϕ(n). eee is the public exponent.
5. Determine d such that d≡e−1mod ϕ(n). d is the private
exponent.
The public key is (e,n) and the private key is (d,n)
Encryption
To encrypt a message mmm:
1. Convert mmm into an integer m such that 0≤m<n
2. Compute the ciphertext ccc using c≡memod n
Summary
 Public Key: (7,33)(7, 33)(7,33)
 Private Key: (3,33)(3, 33)(3,33)
 Original Message (m): 555
 Encrypted Message (c): 141414
 Decrypted Message (m): 555
This example demonstrates how RSA encryption and decryption
are performed step-by-step using small prime numbers for
simplicity. In real-world applications, much larger primes are used
to ensure security.
6) Explain about HMAC algorithm

A) HMAC (Hash-based Message Authentication Code) is a


specific type of message authentication code (MAC) involving a
cryptographic hash function and a secret cryptographic key. It is
used to verify the integrity and authenticity of a message, ensuring
that the message has not been altered and comes from a legitimate
sender. Here's an explanation of how HMAC works and its key
components:
Key Components
1. Hash Function: HMAC can use any cryptographic hash
function, such as SHA-256, SHA-1, or MD5. The hash
function takes an input (or "message") and returns a fixed-size
string, which appears random. Changing even one bit of the
input results in a completely different output, which is a
crucial property for security.
2. Secret Key: A shared secret key known only to the sender
and receiver. The security of HMAC depends on the secrecy
of this key.
HMAC Works
HMAC uses the hash function in combination with the secret key
in a specific way:
1. Padding: The secret key is first padded to the block size of
the hash function. If the key is shorter than the block size, it is
padded with zeros. If it is longer, it is hashed and then
padded.
2. Inner Hashing:
o The padded key is XORed with the inner padding (a

constant byte pattern).


o The result is concatenated with the message to be

authenticated.
o This concatenated string is then hashed using the chosen

hash function.
3. Outer Hashing:
o The padded key is XORed with the outer padding

(another constant byte pattern).


o The result is concatenated with the inner hash result.

o This concatenated string is then hashed again using the

chosen hash function.


Security Considerations
HMAC provides strong security guarantees:
 Resistance to Length Extension Attacks: Unlike some hash
functions, HMAC is not vulnerable to length extension
attacks.
 Key Separation: The use of inner and outer paddings ensures
that the key is used in a way that prevents certain types of
cryptographic attacks.
 Versatility: HMAC can work with any cryptographic hash
function, allowing flexibility based on security requirements
and performance considerations.
HMAC is widely used in various security protocols and
applications, such as SSL/TLS, IPsec, and JSON Web Tokens
(JWTs), to ensure message integrity and authenticity.
7) Explain in detail about Digital Signature Standard Scheme

A) The Digital Signature Standard (DSS) is a suite of algorithms


and standards used for creating and verifying digital signatures.
Digital signatures provide a way to ensure the authenticity and
integrity of a digital message or document. DSS is specified in the
Federal Information Processing Standard (FIPS) 186 by the
National Institute of Standards and Technology (NIST). Here’s a
detailed explanation of the DSS and its key components:
Key Components of DSS
1. Digital Signature Algorithm (DSA)
2. Elliptic Curve Digital Signature Algorithm (ECDSA)
3. RSA Digital Signature Algorithm (RSASSA-PSS)
1. Digital Signature Algorithm (DSA)
DSA is one of the original algorithms specified in DSS. It is based
on the mathematical properties of discrete logarithms.
Key Generation
 Prime number ppp: A large prime number.
 Subprime number qqq: A prime divisor of p−1p-1p−1.
 Base ggg: An element of order qqq in the multiplicative
group of integers modulo ppp.
 Private key xxx: A random integer such that 0<x<q0 < x <
q0<x<q.
 Public key yyy: Computed as y=gxmod.
Signature Generation
To sign a message mmm:
1. Hash the message using a cryptographic hash function
H(m)H(m)H(m).
2. Select a random integer K such that 0<k<q0
3. Compute r=(gkmod p)mod
4. Compute s=(k−1(H(m)+xr))mod
5. The signature is the pair (r,s)
Signature Verification
To verify the signature (r,s)of a message mmm:
1. Hash the message using the same cryptographic hash
function H(m)
2. Compute w=s−1mod q
3. Compute u1=(H(m)⋅w)mod qu_1 =
4. Compute v=((gu1⋅yu2)mod p)mod qv = ((g^{u_1}
5. Verify that v=rv . If they are equal, the signature is valid.
2. Elliptic Curve Digital Signature Algorithm (ECDSA)
ECDSA is a variant of DSA that operates over elliptic curves,
offering equivalent security with smaller key sizes.
Key Generation
 Elliptic curve parameters: Include a prime ppp, the curve
equation, and a base point GGG with order nnn.
 Private key ddd: A random integer such that 0<d<n0 < d <
n0<d<n.
 Public key QQQ: Computed as Q=dGQ = dGQ=dG.
Signature Generation
To sign a message mmm:
1. Hash the message using a cryptographic hash function
H(m)H(m)H(m).
2. Select a random integer kkk such that 0<k<n0 < k < n0<k<n.
3. Compute the point (x1,y1)=kG(x_1, y_1) = kG(x1,y1)=kG and
r=x1mod nr = x_1 \mod nr=x1modn.
4. Compute s=k−1(H(m)+dr)mod ns = k^{-1}(H(m) + dr) \mod
ns=k−1(H(m)+dr)modn.
5. The signature is the pair (r,s)(r, s)(r,s).
Signature Verification
To verify the signature (r,s)(r, s)(r,s) of a message mmm:
1. Hash the message using the same cryptographic hash
function H(m)H(m)H(m).
2. Compute w=s−1mod nw = s^{-1} \mod nw=s−1modn.
3. Compute u1=H(m)⋅wmod nu_1 = H(m) \cdot
4. Compute the point (x1,y1)=u1G+u2
5. Verify that v=rv If they are equal, the signature is valid.
3. RSA Digital Signature Algorithm (RSASSA-PSS)
RSA with Probabilistic Signature Scheme (PSS) is a variant of the
RSA algorithm used for digital signatures.
Key Generation
 Prime numbers ppp and Q: Two large primes.
 Modulus n: Computed as n=pqn = pqn=pq.
 Public exponent E: An integer typically chosen for efficiency.
 Private exponent do: Computed as d=e−1mod (p−1)(q−1)
Signature Generation
To sign a message mmm:
1. Hash the message using a cryptographic hash function
H(m)H(m)H(m).
2. Generate a random salt and concatenate it with the hash.
3. Apply a mask generation function to the concatenated result.
4. Apply the RSA operation to produce the signature sss.
Signature Verification
To verify the signature sss of a message mmm:
1. Apply the RSA verification operation to the signature to
recover the padded message.
2. Extract the hash and salt from the padded message.
3. Verify the hash and the mask generation function application.
4. If the extracted hash matches the expected hash, the
signature is valid.
Security Considerations
 Integrity: Digital signatures ensure that the message has not
been altered.
 Authentication: The signature verifies the identity of the
sender.
 Non-repudiation: The sender cannot deny having sent the
message.
DSS provides a robust framework for digital signatures, offering
multiple algorithm options to balance security and efficiency
requirements in various applications.
9) Explain about Diffie – Helmen Key agreement in key
management.
A) The Diffie-Hellman key agreement protocol is a method for
two parties to securely share a cryptographic key over an
unsecured communication channel. This protocol, introduced by
Whitfield Diffie and Martin Hellman in 1976, is foundational in
cryptography and key management. Here’s a detailed explanation
of the Diffie-Hellman key agreement protocol:
Overview
The Diffie-Hellman key agreement allows two parties, typically
referred to as Alice and Bob, to generate a shared secret key. This
key can then be used for secure communication using symmetric
encryption algorithms. The protocol relies on the mathematical
difficulty of the discrete logarithm problem, which makes it
computationally infeasible for an eavesdropper to derive the
shared secret key from the exchanged values.
Key Components
1. Prime Number P: A large prime number.
2. Primitive Root g: A number ggg that, when raised to
successive powers, generates all integers from 1 to p−1p-
1p−1 (modulo ppp).
Protocol Steps
1. Initialization
 Both parties agree on the values of p and go. These values do
not need to be kept secret and can be shared publicly.
2. Key Generation
Alice:
 Chooses a private key aaa, which is a random integer such
that 0<a<p0 < a < p0<a<p.
 Computes the public value A=gamod
 Sends the public value AAA to Bob.
Bob:
 Chooses a private key bbb, which is a random integer such
that 0<b<p0 < b < p0<b<p.
 Computes the public value B=gbmod
 Sends the public value BBB to Alice.
Security
The security of the Diffie-Hellman key agreement protocol is
based on the difficulty of the discrete logarithm problem. Even if
an eavesdropper (often called Eve) intercepts the public values
AAA and BBB, deriving the shared secret from these values is
computationally infeasible without knowing the private keys a or
b.
Variants and Enhancements
Elliptic Curve Diffie-Hellman (ECDH)
Elliptic Curve Diffie-Hellman (ECDH) is a variant of the Diffie-
Hellman protocol that uses elliptic curve cryptography (ECC)
instead of modular arithmetic with large prime numbers. ECDH
provides the same level of security with smaller key sizes, making
it more efficient.
Diffie-Hellman with Ephemeral Keys
Ephemeral Diffie-Hellman (DHE) involves generating new
temporary private and public keys for each session. This approach
provides forward secrecy, meaning that even if a long-term private
key is compromised, past session keys remain secure.
10) Discuss the Kerberos authentication service with neat sketch.

A) Kerberos is a network authentication protocol designed to


provide strong authentication for client-server applications by
using secret-key cryptography. It helps to securely identify and
authenticate users and services over an insecure network.
Developed at MIT, Kerberos is widely used in various systems,
including Windows domains and UNIX environments.
Overview
Kerberos operates based on the concept of tickets to authenticate
users and services. It uses a trusted third party, the Key
Distribution Center (KDC), which consists of two main
components: the Authentication Server (AS) and the Ticket
Granting Server (TGS).
Key Components
1. Client: The user or service requesting access to another
service.
2. Server: The service that the client wants to access.
3. Key Distribution Center (KDC): The trusted third party that
issues tickets. It has two components:
o Authentication Server (AS): Authenticates the client and

issues a Ticket Granting Ticket (TGT).


o Ticket Granting Server (TGS): Issues service tickets based

on the TGT.
4. Ticket Granting Ticket (TGT): A special ticket used to request
service tickets from the TGS.
5. Service Ticket: A ticket that allows access to a specific
service.
Kerberos Authentication Process
Step-by-Step Process
1. Initial Authentication (AS Request)
o The client sends a request to the AS for a TGT. This

request includes the client's ID.


o The AS verifies the client's identity, typically using a

password or some pre-shared secret. If the client is


authenticated, the AS issues a TGT encrypted with the
TGS's secret key and sends it back to the client. This
response also includes a session key encrypted with the
client's secret key (derived from the client's password).
2. Requesting a Service Ticket (TGS Request)
o The client decrypts the session key using its own secret

key and stores the TGT.


o To access a specific service, the client sends the TGT to

the TGS along with an authenticator (a timestamp


encrypted with the session key).
o The TGS decrypts the TGT using its secret key, extracts

the session key, and uses it to decrypt the authenticator.


If the timestamp is valid (indicating that the TGT was
issued recently), the TGS issues a service ticket for the
requested service.
3. Accessing the Service (Service Request)
o The client sends the service ticket and a new

authenticator to the service server.


o The service server decrypts the service ticket using its

secret key, extracts the session key, and uses it to


decrypt the authenticator.
o If the timestamp in the authenticator is valid, the service

server grants access to the client.


Explanation of the Steps
1. Request TGT: The client sends an authentication request to
the AS.
2. Receive TGT: The AS responds with a TGT and a session key
encrypted with the client's secret key.
3. Request Service Ticket: The client sends the TGT and an
authenticator to the TGS to request a service ticket.
4. Receive Service Ticket: The TGS responds with a service
ticket.
5. Request Service: The client sends the service ticket and a
new authenticator to the service server.
6. Access Granted: The service server verifies the service ticket
and authenticator, and grants access if they are valid.
Kerberos provides a robust and secure way to manage
authentication in networked environments, leveraging the strength
of secret-key cryptography and a centralized authentication model.
Its design ensures that even if the network is insecure, the
authentication process remains secure.

11) Explain in detail about Pretty Good Privacy (PGP) Protocol


A) Pretty Good Privacy (PGP) is a data encryption and decryption
program that provides cryptographic privacy and authentication
for data communication. Created by Phil Zimmermann in 1991,
PGP is often used for securing emails, files, and other forms of
digital communication. PGP combines features of both symmetric
and asymmetric cryptography to offer confidentiality, integrity,
authentication, and non-repudiation.
Key Components
1. Public Key Cryptography (Asymmetric Encryption)
2. Symmetric Key Cryptography
3. Hash Functions
4. Digital Signatures
How PGP Works
PGP operates through a combination of these cryptographic
methods to achieve its security objectives. Here’s a detailed
breakdown of the process:
1. Key Generation
 Asymmetric Key Pair: Each user generates a pair of keys – a
public key and a private key. The public key is shared with
others, while the private key is kept secret.
 Symmetric Session Key: For each message, a unique session
key (a one-time-use symmetric key) is generated to encrypt
the message content.
2. Encryption Process
Encrypting the Message
1. Symmetric Encryption: The plaintext message is encrypted
using a symmetric encryption algorithm (e.g., AES) and the
session key. This produces the ciphertext.
2. Asymmetric Encryption of Session Key: The session key is
then encrypted using the recipient’s public key. This ensures
that only the recipient, who possesses the corresponding
private key, can decrypt the session key.
3. Decryption Process
Decrypting the Session Key
1. Asymmetric Decryption: The recipient uses their private key
to decrypt the session key.
2. Symmetric Decryption: The recipient then uses the
decrypted session key to decrypt the ciphertext, restoring the
original plaintext message.
4. Digital Signatures
PGP also allows the sender to digitally sign a message, providing
authentication and non-repudiation.
Signing the Message
1. Hashing: A hash function (e.g., SHA-256) is applied to the
plaintext message to produce a message digest.
2. Asymmetric Signature: The message digest is encrypted
using the sender’s private key, creating a digital signature.
Security Features
1. Confidentiality: Ensures that only the intended recipient can
read the message.
2. Integrity: Ensures that the message has not been altered
during transit.
3. Authentication: Verifies the identity of the sender.
4. Non-Repudiation: The sender cannot deny having sent the
message.
Applications
 Email Security: Encrypting and signing emails to ensure
confidentiality and authenticity.
 File Encryption: Securing files and documents for storage or
transfer.
 Secure Communication: Providing a secure channel for
communication over potentially insecure networks.
12) Explain in detail SSL Message formats

A) SSL/TLS Handshake Protocol


The SSL/TLS handshake is a process that establishes a secure
connection between a client and a server. The handshake involves
several message exchanges, each with specific formats and
purposes.
1. ClientHello
Format:
 Version: Protocol version (2 bytes)
 Random: A 32-byte random number (4 bytes for timestamp
and 28 bytes for random)
 Session ID: Session ID (variable length, 0-32 bytes)
 Cipher Suites: List of supported cipher suites (variable length,
2 bytes each)
 Compression Methods: List of supported compression
methods (variable length, 1 byte each)
 Extensions: Optional extensions (variable length)
2. ServerHello
Format:
 Version: Protocol version (2 bytes)
 Random: A 32-byte random number (4 bytes for timestamp
and 28 bytes for random)
 Session ID: Session ID chosen by the server (variable length,
0-32 bytes)
 Cipher Suite: Selected cipher suite (2 bytes)
 Compression Method: Selected compression method (1
byte)
 Extensions: Optional extensions (variable length)
3. Certificate
This message is sent by the server (and optionally by the client) to
provide the peer with its certificate chain.
Format:
 Certificates Length: Total length of the certificates (3 bytes)
 Certificate: One or more certificates (variable length, each
prefixed with its length)
SSL/TLS Record Protocol
The record protocol is used to encapsulate higher-level protocol
messages (e.g., Handshake, Application Data) for transmission.
Each record consists of a header and the payload.
Record Header
Format:
 Content Type: Type of the message (1 byte)
o 0x14: ChangeCipherSpec

o 0x15: Alert

o 0x16: Handshake

o 0x17: Application Data


 Version: Protocol version (2 bytes)
 Length: Length of the payload (2 bytes)
Application Data
Once the handshake is complete, the application data is
transmitted using the record protocol. Each record contains a
header and encrypted application data.
Format:
 Header: Record header as described above
 Data: Encrypted application data (variable length)
ChangeCipherSpec
This message is used to notify the peer that the subsequent records
will be protected using the newly negotiated cipher suite and keys.
Format:
 Content Type: ChangeCipherSpec (1 byte, 0x14)
 Value: Always 1 byte with the value 0x01
13) Explain in detail about SSL architecture

A) SSL (Secure Sockets Layer) and its successor, TLS (Transport


Layer Security), are designed to provide secure communication
over a computer network. The architecture of SSL/TLS is modular
and comprises several protocols and components that work
together to ensure confidentiality, integrity, and authentication.
Here's a detailed explanation of the SSL/TLS architecture:
1. SSL/TLS Protocol Stack
The SSL/TLS protocol stack is composed of multiple layers, each
responsible for different aspects of secure communication:
1.1. Record Layer
The Record Layer is the lowest level of the SSL/TLS stack. It
encapsulates higher-level protocol messages into records and
ensures their secure transmission. It provides:
 Fragmentation: Breaks messages into manageable blocks.
 Compression (optional): Reduces the size of the message
data.
 Encryption: Encrypts message data to ensure confidentiality.
 Message Integrity: Adds a Message Authentication Code
(MAC) to ensure data integrity.
1.2. Handshake Protocol
The Handshake Protocol is responsible for establishing a secure
session between the client and server. It involves several message
exchanges to negotiate security parameters, authenticate the
parties, and establish shared secrets.
 ClientHello: Initiates the handshake and proposes security
parameters.
 ServerHello: Responds to the ClientHello and selects security
parameters.
 Certificate: Exchanges certificates for authentication.
 ServerKeyExchange: Sends server-specific key exchange data.
 ClientKeyExchange: Sends client-specific key exchange data.
 Finished: Concludes the handshake with a hash of all
previous handshake messages.
1.3. ChangeCipherSpec Protocol
The ChangeCipherSpec Protocol is a simple protocol that signals a
switch to the newly negotiated cipher suite. It consists of a single
message indicating that subsequent records will be protected using
the negotiated algorithms and keys.
2. SSL/TLS Components
2.1. Cryptographic Algorithms
SSL/TLS relies on various cryptographic algorithms for different
purposes:
 Symmetric Encryption: Used for data confidentiality (e.g.,
AES, 3DES).
 Asymmetric Encryption: Used for key exchange and
authentication (e.g., RSA, Diffie-Hellman).
 Hash Functions: Used for data integrity and MAC (e.g., SHA-
256, MD5).
 Digital Signatures: Used for authentication (e.g., RSA,
ECDSA).
SSL/TLS Record Protocol Operation
The Record Protocol operates continuously to secure data
transmission:
1. Fragmentation: Application data is fragmented into
manageable blocks.
2. Compression: Data is optionally compressed.
3. MAC Calculation: A MAC is calculated and appended to the
data.
4. Encryption: The data and MAC are encrypted.
5. Record Construction: The encrypted data is encapsulated
into records with appropriate headers.
6. Transmission: Records are transmitted over the network.
The SSL/TLS architecture is designed to provide a robust and
flexible framework for secure communication. It integrates
multiple protocols, cryptographic algorithms, and components to
ensure that data is transmitted confidentially, integrity is
maintained, and the communicating parties are authenticated.
Understanding this architecture is crucial for implementing and
maintaining secure network communication.
14) Compare SSL and TLS protocols.
A) SSL stands for Secure Socket Layer while TLS stands for
Transport Layer Security. Both Secure Socket Layer and
Transport Layer Security are the protocols used to provide
security between web browsers and web servers. The main
difference between Secure Socket Layer and Transport Layer
Security is that, in SSL (Secure Socket Layer), the Message
digest is used to create a master secret and It provides the basic
security services which are Authentication and confidentiality.
while In TLS (Transport Layer Security), a Pseudo-random
function is used to create a master secret.
There are some differences between SSL and TLS which are
given below:

SSL TLS

SSL stands for Secure Socket TLS stands for Transport


Layer. Layer Security.

SSL (Secure Socket Layer) TLS (Transport Layer


supports Security) does not support
the Fortezza algorithm. the Fortezza algorithm.

SSL (Secure Socket Layer) is TLS (Transport Layer


the 3.0 version. Security) is the 1.0 version.
SSL TLS

In TLS(Transport Layer
In SSL( Secure Socket
Security), a Pseudo-random
Layer), the Message digest is
function is used to create a
used to create a master secret.
master secret.

In SSL( Secure Socket In TLS(Transport Layer


Layer), the Message Security), Hashed Message
Authentication Code protocol Authentication Code protocol
is used. is used.

SSL (Secure Socket Layer) is


more complex than TLS (Transport Layer
TLS(Transport Layer Security) is simple.
Security).

SSL (Secure Socket Layer) is


TLS (Transport Layer
less secured as compared to
Security) provides high
TLS(Transport Layer
security.
Security).

TLS is highly reliable and


SSL is less reliable and
upgraded. It provides less
slower.
latency.

SSL has been depreciated. TLS is still widely used.

SSL uses port to set up TLS uses protocol to set up


explicit connection. implicit connection.

You might also like

pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy