Cryptography and Network Security 2022 Beu Pyq Solution
Cryptography and Network Security 2022 Beu Pyq Solution
Given:
p = 11
q = 19
e = 17
M (message) = 5
Calculate n=p×q=11×19=209
Now, apply the encryption formula: C≡517(mod209)
To calculate this, you can use modular exponentiation. The result is: C≡56(mod209)
2. (a) What are the two general approaches to attack a cipher? List and
briefly define the types of cryptanalytic attacks based on what is
known to the attacker.
Ans:- The two general approaches to attack a cipher are:
where:
Each party generates a unique key pair: a public key and a private key
using a strong and secure algorithm (e.g., RSA, ECC).
Rationale: Public-key cryptography ensures that each party has a unique
pair of keys, providing a foundation for secure communication.
2. Key Exchange:
5. Message Transmission:
The encrypted message and digital signature are transmitted over the
insecure channel.
Party B receives the message and decrypts it using its private key.
Party B generates a hash of the received message and compares it to the
hash within the digital signature.
Rationale: The comparison of hashes ensures data integrity and
authenticity. Any modification to the message will result in a mismatch,
indicating potential tampering.
Party B verifies the digital signature using Party A's public key. If the
verification is successful, Party B can confirm the message's origin and
integrity.
Rationale: The digital signature provides non-repudiation, as only Party
A possesses the private key necessary to create a valid signature. This
prevents Party A from denying their involvement in sending the message.
8. Non-Repudiation:
Given:
e=65
n=2881
You can try different values for p and q until you find the correct pair that satisfies
n=2881.
53×59=3127
Φ(n)=(53−1)×(59−1)=52×58=3016
Step 2: Use the Extended Euclidean Algorithm to find the multiplicative inverse
of e modulo Φ(n):
e×d≡1(modΦ(n))
3016=46×65+26
65=2×26+13
26=2×13+0
Now, work backward:
13=65−2×26
13=65−2×(3016−46×65)
13=93×65−2×3016
So, d=93.
Conclusion: The private key ( d) for the given public key ( e=65,n=2881 ) is d=93
1. Tampering Attackers:
These attackers attempt to modify the content of the message
during transmission. The goal is to alter the information in a way
that may be beneficial to the attacker or to disrupt the
communication. Tampering attacks can include inserting, deleting,
or modifying data within the message.
2. Replay Attackers:
In replay attacks, an attacker intercepts a valid message and
retransmits it to the recipient. The attacker's intention might be to
trick the recipient into processing the same message multiple times,
potentially causing unintended actions or gaining unauthorized
access.
1. Integrity Verification:
MACs are used to verify that the received message has not been
altered during transmission. If the content of the message is
modified, the computed MAC will not match the received MAC,
indicating potential tampering.
2. Authentication:
MACs provide a means of authenticating the sender of the
message. Since the MAC is generated using a secret key known
only to the sender and the recipient, a correct MAC implies that the
sender possessed the key.
3. Data Origin Authentication:
MACs ensure that the received message is indeed from the claimed
sender. Without the correct secret key, an attacker cannot generate
a valid MAC that matches the one computed by the sender.
4. Non-Repudiation:
While non-repudiation is more strongly associated with digital
signatures, in some contexts, MACs can be used to establish a level
of non-repudiation. If only the sender possesses the secret key used
to generate the MAC, the sender cannot later deny sending the
message.
5. Protection Against Replay Attacks:
By incorporating a timestamp or a sequence number along with the
message in the MAC computation, MACs can help protect against
replay attacks. The recipient can check if the timestamp or
sequence number is within an acceptable range.
6(b)Differentiate between the symmetric key cryptography and
public key cryptography.
Ans:- As we know that , Public key cryptography is also known as
Asymmetric key cryptography.
The length of key used is 128 or The length of key used is 2048 or
256 bits higher
Ans:- X.509 is a standard that defines the format of public key certificates, which are a key
component of the public key infrastructure (PKI). X.509 certificates are widely used in
various security protocols, including TLS/SSL for securing web communication.
The X.509 format of a certificate specifies the structure and content of a digital certificate,
including information about the certificate holder and their public key. Here is an overview of
the key components of an X.509 certificate:
1. Version:
Indicates the version of the X.509 standard used to encode the certificate.
Common versions include v1, v2, and v3.
2. Serial Number:
A unique identifier assigned by the certificate issuer to differentiate one
certificate from another.
3. Signature Algorithm:
Specifies the algorithm used to sign the certificate. Common algorithms
include RSA, DSA, and ECDSA.
4. Issuer:
Identifies the entity (usually a certification authority) that issues the certificate.
5. Validity Period:
Specifies the start and end dates during which the certificate is considered
valid.
6. Subject:
Identifies the entity (e.g., an individual, organization, or device) associated
with the public key in the certificate.
7. Subject Public Key Info:
Contains information about the public key, including the algorithm used and
the actual public key value.
8. Issuer Unique Identifier (optional):
An optional field that may be used to include additional unique identifiers for
the issuer.
9. Subject Unique Identifier (optional):
An optional field that may be used to include additional unique identifiers for
the subject.
10. Extensions (v3 certificates):
Additional fields that can include various extensions providing extra
information, such as key usage, subject alternative names, and policies.
11. Signature Algorithm (Algorithm Identifier):
Specifies the algorithm used by the issuer to sign the certificate.
(b) Public Key distribution
Ans:- Public key distribution is a crucial aspect of public key cryptography and secure
communication. In a public key cryptography system, each participant has a pair of keys: a
public key and a private key. The public key is shared openly, while the private key is kept
secret. Public key distribution involves making public keys available to other entities in a
secure and efficient manner.
Here are the key aspects and methods associated with public key distribution:
Ans:- The Diffie-Hellman key exchange technique is a method for two parties to
securely agree on a shared secret key over an insecure communication channel. It
was introduced by Whitfield Diffie and Martin Hellman in 1976 and is widely used in
secure communication protocols.
1. Initialization:
Both parties, let's call them Alice and Bob, agree on two public
parameters:
A large prime number, p .
A primitive root modulo p , often denoted as g .
2. Private Keys:
Each party generates its private key:
Alice selects a private key, a .
Bob selects a private key, b.
3. Public Keys:
Both parties calculate their public keys based on their private keys and
the agreed-upon parameters:
Alice computes A=g^a mod p and sends A to Bob.
Bob computes B=g^b mod p and sends B to Alice.
4. Exchange Public Keys:
Alice and Bob exchange their public keys ( A and B ) openly, but these
values alone cannot be used to derive the shared secret.
5. Shared Secret Calculation:
Both parties independently calculate the shared secret using their own
private keys and the received public key:
Alice computes s=B^a mod p .
Bob computes s=A^b mod p .
6. Result:
Since modular exponentiation is commutative, both Alice and Bob
arrive at the same shared secret ( s). This shared secret can be used as
the key for symmetric encryption or any other cryptographic purpose.
8(b) Alice and Bob use the Diffie-Hellman key exchange technique
with a common prime q = 23 and a primitive root a = 5.
1. Output Size:
SHA-512 produces a fixed-size output of 512 bits (64 bytes).
2. Bit Length:
The internal operations of SHA-512 are based on 64-bit words,
providing a higher level of security compared to SHA-256, which
uses 32-bit words.
3. Rounds:
SHA-512 uses 80 rounds of processing to mix and transform the
input data. The increased number of rounds enhances its resistance
to cryptanalytic attacks.
4. Block Size:
The block size for SHA-512 is 1024 bits (128 bytes). The message
is padded to a multiple of the block size before processing.
5. Message Padding:
SHA-512 employs the Merkle–Damgård construction with a
padding scheme that appends a '1' bit followed by a variable
number of '0' bits, along with the length of the original message.
6. Word Size:
The word size of SHA-512 is 64 bits. The message is processed in
1024-bit blocks, and the compression function operates on 64-bit
words.
7. Initial Hash Values (IVs):
SHA-512 uses eight 64-bit initial hash values (IVs) derived from
the fractional parts of the square roots of the first eight prime
numbers.
Here is a simplified representation of the compression function used in SHA-
512:
1. Input:
The input to the compression function is the current hash value
(512 bits) and the message block (1024 bits).
2. Operation:
The compression function performs a series of bitwise logical
operations (such as AND, OR, XOR), modular addition, and
bitwise rotations on the current hash value and the message block.
3. Output:
The output of the compression function is a new hash value, which
becomes the input for processing the next message block.
4. Iteration:
The compression function is iterated multiple times (80 rounds in
the case of SHA-512) for each message block, enhancing the
diffusion and mixing properties of the hash function.
5. Final Hash Value:
After processing all message blocks, the final hash value is
obtained as the cumulative result of processing each block.
Similarities:
1. Rounds:
Both SHA-512 and a Feistel cipher involve multiple
rounds of processing. SHA-512 has 80 rounds in its
compression function, and a Feistel cipher with 80 rounds
would similarly iterate through its processing steps.
2. Bitwise Operations:
Both structures involve bitwise logical operations, such as
AND, OR, XOR. These operations contribute to the
diffusion and confusion properties essential for
cryptographic security.
3. Complexity:
Both structures are designed to be computationally
complex, making them resistant to various types of
cryptanalysis.
Differences:
1. Block Structure:
In SHA-512, the input block is processed as a whole, and
the compression function updates the entire hash value. In
a Feistel cipher, the input is typically divided into two
halves, and only one half is processed at a time.
2. Operation Types:
While both involve bitwise operations, SHA-512's
compression function includes modular addition and
bitwise rotations, which are not inherent to a typical
Feistel structure. Feistel ciphers often use simple bitwise
operations, such as XOR and AND.
3. Message Dependency:
In SHA-512, the compression function processes the entire
message block, and the output is used as the new hash
value for the next block. In a Feistel cipher, each round's
output is dependent on the previous round's output, and the
two halves of the block are swapped.