0% found this document useful (0 votes)
44 views

CNS Mid2

The document discusses several topics in cryptography and network security: 1. It explains Fermat's Little Theorem, RSA calculations, and the SSL handshake protocol. 2. It defines Euler's Theorem, categories of hash functions, and differences between SSL sessions and connections. 3. It provides an example of using the Chinese Remainder Theorem and describes the process of RSA encryption/decryption and how IPSec provides confidentiality and authentication.

Uploaded by

kiranyadav3304
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)
44 views

CNS Mid2

The document discusses several topics in cryptography and network security: 1. It explains Fermat's Little Theorem, RSA calculations, and the SSL handshake protocol. 2. It defines Euler's Theorem, categories of hash functions, and differences between SSL sessions and connections. 3. It provides an example of using the Chinese Remainder Theorem and describes the process of RSA encryption/decryption and how IPSec provides confidentiality and authentication.

Uploaded by

kiranyadav3304
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
You are on page 1/ 9

🤖

CNS-Mid2
Part A:

1. Fermat’s Little Theorem:

Definition: Fermat's Little Theorem states that if 'p' is a prime number and 'a'
is an integer not divisible by 'p', then a^(p-1) is congruent to 1 modulo 'p'
(written as a^(p-1) ≡ 1 (mod p)).

Application: Fermat's Little Theorem is often used in primality testing


algorithms and modular arithmetic to efficiently compute large
exponentiations.

2. MDC and MAC:

MDC (Message Digest Code): It is a cryptographic hash function used to


create a fixed-size output (digest) from variable-length input data. It is a one-
way function, meaning it is computationally infeasible to reverse the process
and obtain the original input from the digest.

MAC (Message Authentication Code): It is a cryptographic technique that


involves using a secret key to generate a fixed-size value (the MAC) from
the input data. It provides integrity and authenticity verification, ensuring that
the data has not been tampered with and that it comes from a legitimate
source.

3. SSL Handshake Protocol:

CNS-Mid2 1
Goal of Each Phase:

Phase 1 (Initiation): The client and server establish communication,


agree on the cryptographic algorithms to be used, and exchange
necessary parameters, such as supported cipher suites and random
values.

Phase 2 (Server Authentication and Key Exchange): The server


presents its digital certificate to the client to prove its identity. The client
verifies the certificate and generates or agrees upon a pre-master
secret, which is securely exchanged with the server.

Phase 3 (Client Authentication and Key Exchange): If client


authentication is required, the client presents its digital certificate to the
server. The server verifies the certificate, and both parties exchange
additional messages to establish the session keys.

Phase 4 (Finishing): Both client and server send messages to confirm


the completion of the handshake. They notify each other that future
messages will be encrypted using the negotiated session keys.

4. Calculations for RSA:

Given p = 19, q = 23, and e = 3:

n = p * q = 19 * 23 = 437

φ(n) = (p - 1) * (q - 1) = 18 * 22 = 396

d = e^(-1) mod φ(n) = 3^(-1) mod 396 ≡ 267

Part 2:

1. Euler’s Theorem:

Definition: Euler's Theorem is an extension of Fermat's Little Theorem. It


states that if 'n' is a positive integer, 'a' is an integer coprime to 'n', then
a^φ(n) is congruent to 1 modulo 'n' (written as a^φ(n) ≡ 1 (mod n)), where
φ(n) is Euler's totient function.

Application: Euler's Theorem is used in cryptography, specifically in the RSA


algorithm, to calculate the private key exponent 'd' from the public key
exponent 'e' and totient value 'φ(n)'.

2. Categories of Hash Functions:

CNS-Mid2 2
Cryptographic Hash Functions: These are one-way functions designed to
be collision-resistant, ensuring that it is computationally infeasible to find two
different inputs that produce the same hash output. They are widely used in
digital signatures and password hashing.

Non-Cryptographic Hash Functions: These hash functions are generally


designed for speed and efficiency. They are used in applications like hash
tables, checksums, and data structures where collision resistance is not a
primary concern.

3. SSL: Session vs. Connection:

SSL Session: An SSL session is a logical connection between a client and


a server. It includes the negotiation and establishment of cryptographic
parameters, like encryption algorithms and session keys, which can be
reused to accelerate subsequent connections between the same client and
server.

SSL Connection: An SSL connection, also known as an SSL handshake,


refers to the process of setting up a secure communication channel between
a client and a server using SSL/TLS protocols. It involves the exchange of
messages to authenticate, agree on encryption, and establish keys.

4. Chinese Remainder Theorem (CRT) with Example:

Definition: The Chinese Remainder Theorem is a mathematical theorem that


allows solving a system of congruences with respect to pairwise coprime
moduli.

Example: Let's solve the following system of congruences using CRT:

x ≡ 2 (mod 3)

x ≡ 3 (mod 5)

x ≡ 2 (mod 7)

First, find the product of the moduli: N = 3 * 5 * 7 = 105

Next, calculate the individual modular inverses:

y1 ≡ 105 / 3 ≡ 35 (mod 3)

y2 ≡ 105 / 5 ≡ 21 (mod 5)

y3 ≡ 105 / 7 ≡ 15 (mod 7)

Finally, compute the solution using CRT:

CNS-Mid2 3
x ≡ (2 * 35 * 1) + (3 * 21 * 1) + (2 * 15 * 1) ≡ 2 + 63 + 30 ≡ 95 (mod 105)

So, the solution to the system of congruences is x ≡ 95 (mod 105).

1. Explain the Process of RSA Cryptosystem:


The RSA cryptosystem is a widely used asymmetric encryption algorithm.
The process of RSA involves key generation, encryption, and decryption:

Key Generation:

1. Select two large prime numbers, 'p' and 'q'.

2. Calculate the modulus 'n' by multiplying p and q: n = p * q.

3. Compute Euler's totient function φ(n) = (p - 1) * (q - 1).

4. Choose a public exponent 'e', which is coprime to φ(n) (commonly


chosen as 65537).

5. Calculate the private exponent 'd' such that (e * d) ≡ 1 (mod φ(n)).

6. Public key: (e, n), Private key: (d, n).

Encryption:

1. The sender converts the plaintext message into a numerical value


'm'.

2. The sender uses the recipient's public key (e, n) to compute the
ciphertext 'c' as c ≡ m^e (mod n).

Decryption:

1. The recipient uses their private key (d, n) to compute the original
message as m ≡ c^d (mod n)

2) Explain the Use of IPSec to Provide Both Confidentiality and


Authentication:

IPSec is a suite of protocols that operate at the network layer (Layer 3)


of the OSI model and is used to secure IP communications. It can

CNS-Mid2 4
provide both confidentiality and authentication for data transmitted over
IP networks.

Confidentiality: IPSec achieves confidentiality through


encryption. When two parties communicate, IPSec encrypts the
data before transmitting it over the network. Encryption ensures
that even if an unauthorized entity intercepts the data, it will be in
an unreadable format, protecting the data's confidentiality. The
recipient, possessing the appropriate decryption key, can convert
the encrypted data back to its original form.

Authentication: IPSec provides authentication mechanisms to


verify the identity of communicating parties. It ensures that the
data received is from a legitimate source and has not been
altered during transmission.

There are two common methods for authentication in IPSec:

Digital Signatures: In this method, the sender attaches a


digital signature to the data using their private key. The
recipient can use the sender's public key to verify the
signature, ensuring the data's authenticity. If the data is
tampered with in transit, the signature verification will fail,
indicating possible unauthorized alterations.

Preshared Keys: In this method, the sender and recipient


agree on a shared secret key in advance. This preshared
key is used to authenticate the parties during the
communication. If the received data is decrypted
successfully using the preshared key, the recipient knows
that the sender is authentic.

3) SHA-512 cryptographic hash function in a bit more detail:

1. Input Size:

SHA-512 can handle large messages: It can process input


messages up to 2^128 - 1 bits long, making it suitable for
managing extensive data.

2. Output Size:

The message digest: SHA-512 generates a fixed-size output


called the "message digest." This digest is 512 bits long (64

CNS-Mid2 5
bytes) and serves as a unique representation of the input
message.

3. Collision Resistance:

Ensuring uniqueness: SHA-512 is designed to be collision-


resistant, which means it is highly improbable to find two
different messages that produce the same 512-bit message
digest.

Data integrity: This property ensures the integrity of data, as


even small changes in the input message lead to significantly
different hash values.

4. One-Way Function:

Easy computation: It is easy and fast to compute the hash value


(message digest) from the input data.

Irreversibility: However, it is computationally infeasible and


practically impossible to reverse the process and retrieve the
original data from the hash value. This makes SHA-512 a one-
way function.

5. Security:

Trustworthy algorithm: SHA-512 is considered secure and


robust against various cryptographic attacks, ensuring that the
generated hash values cannot be easily tampered with or
forged.

Data authenticity: Its security properties make it ideal for


applications requiring data integrity and authenticity verification.

CNS-Mid2 6
Diagram:
The diagram visually demonstrates the processing steps of the SHA-512
algorithm, where the input data undergoes several rounds of
mathematical operations to produce the 512-bit message digest. The
complexity of these operations enhances the security of the hash
function, making it suitable for various cryptographic applications.

4) Justification for the Need and Exchange Process of Session


Keys using KDC:
Session keys play a crucial role in securing communication between
entities in a network. The Key Distribution Center (KDC) is a centralized
server responsible for securely distributing session keys to parties
engaged in secure communication. The need and exchange process of
session keys using KDC can be justified as follows:

1. Need for Session Keys:

Efficiency: Long-term encryption keys used in public-key


cryptography can be computationally expensive for encrypting large
volumes of data. Session keys are temporary keys generated
specifically for a single communication session, which are faster and
more efficient in encrypting and decrypting data.

Forward Secrecy: Session keys provide forward secrecy, meaning


that even if the long-term encryption keys are compromised in the
future, the data encrypted with session keys remains secure as the
session keys were only used for a specific session.

CNS-Mid2 7
Reduced Risk of Key Exposure: Using long-term keys for multiple
sessions increases the risk of key exposure if any one of the
sessions is compromised. Session keys reduce this risk by being
unique for each session, limiting the scope of potential damage if a
key is compromised.

2. Exchange Process of Session Keys using KDC:


The exchange process of session keys using the KDC involves the
following steps:

1. Authentication:

The two parties (A and B) involved in secure communication


initiate the process by authenticating themselves to the KDC.

Each party sends a request to the KDC along with their identity
or digital certificate to prove their authenticity.

2. Session Key Request:

Once the KDC verifies the identities of parties A and B, it


generates a unique session key for their communication
session.

The KDC encrypts the session key twice: once using A's long-
term encryption key and once using B's long-term encryption
key.

3. Session Key Distribution:

The KDC sends the two encrypted copies of the session key
back to parties A and B.

Each party can decrypt the session key meant for them using
their respective long-term encryption keys.

Now both parties have the same session key without ever
having directly shared it with each other.

4. Secure Communication:

Parties A and B can use the session key to encrypt and decrypt
their communication during the current session.

As session keys are temporary and unique for each session,


even if the session key is compromised, it has no impact on
future sessions.

CNS-Mid2 8
By using the KDC to securely distribute session keys, parties can
establish secure communication without the need for direct key
exchange, ensuring confidentiality, authentication, and efficiency in their
communication.

CNS-Mid2 9

You might also like