0% found this document useful (0 votes)
30 views21 pages

Cryptography Question Bank 2 and 3 UNIT

The document covers key concepts in public key cryptography, specifically the Diffie-Hellman key exchange, its applications, and the principles of stream and block ciphers. It details the steps of the Diffie-Hellman algorithm, advantages and disadvantages of stream ciphers, and various modes of operation for block ciphers. Additionally, it includes examples and problems related to encryption and decryption using these cryptographic techniques.
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)
30 views21 pages

Cryptography Question Bank 2 and 3 UNIT

The document covers key concepts in public key cryptography, specifically the Diffie-Hellman key exchange, its applications, and the principles of stream and block ciphers. It details the steps of the Diffie-Hellman algorithm, advantages and disadvantages of stream ciphers, and various modes of operation for block ciphers. Additionally, it includes examples and problems related to encryption and decryption using these cryptographic techniques.
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

UNIT - II: Public Key Cryptography and RSA

2 Marks:
1. Define Diffie-Hellman key exchange.
• Ans-The Diffie-Hellman key exchange (also known as exponential key
exchange) is a method for securely exchanging cryptographic keys over an
insecure channel.

2. List applications of Diffie Hellman Exchange algorithm.


[Link] Key Infrastructure
[Link]/TLS
3. SSH
4. VPNs
5. SFTP
4 Marks:
1. Write Diffie Hellman Exchange algorithm Steps.
• Ans-Alice and Bob agree on two large prime numbers, p and g, and a public
key exchange algorithm.
• Alice chooses a secret integer, a, and computes A = g^a mod p. She sends A to
Bob.
• Bob chooses a secret integer, b, and computes B = g^b mod p. He sends B to
Alice.
• Alice computes s = B^a mod p. Bob computes s = A^b mod p.
• Alice and Bob now both have shared secret keys, which they can use to
establish a secure communication channel.

2. Explain applications of Diffie Hellman Exchange algorithm.


• Ans-Public Key Infrastructure: The public-key infrastructure (PKI) is a set of
tools and rules to enforce public key cryptography with multiple entities. It also
governs the issuance of digital certificates over the internet to maintain data
confidentiality. With the Diffie-Hellman algorithm as the base, the PKI system
was created to enable the exchange of public keys with anyone who requests for
it and has the appropriate permissions.
• SSL/TLS − The Secure Sockets Layer (SSL) and Transport Layer Security (TLS)
protocols use the Diffie-Hellman key exchange to establish a secure channel
between a client and a server. This allows the client and server to exchange
encrypted messages over an insecure network, such as the Internet.
• SSH − The Secure Shell (SSH) protocol uses the Diffie-Hellman key exchange
to establish a secure channel between a client and a server. This allows users to
securely log in to a remote server and execute commands, transfer files, and
perform other tasks over an insecure network.
• VPNs − Many VPN protocols, such as IPSec and OpenVPN, use the Diffie-
Hellman key exchange to establish a secure connection between a client and a
server. This allows the client and server to exchange encrypted traffic over an
insecure network, such as the Internet.
• SFTP − The Secure File Transfer Protocol (SFTP) uses the Diffie-Hellman key
exchange to establish a secure channel between a client and a server. This
allows users to securely transfer files between two systems over an insecure
network.

3. P=33, G (Primitive Root) =8, A=3, B=2. Find the D-H Key shared between
them.
4. P=23, G =7, A=3, B=6, Find D-H Key shared between them.
Ans-
5. P=23, G =5, A=4, B=3. Find the D-H Key shared between them.
Ans-
6. P=7, G =3, A=2, B=5 Find D-H Key shared between them.
Ans-
8 Marks:
1. Write the steps for Diffie Hellman Algorithm and solve the following
algorithm. P=33, G=8, A=3, B=2 find D-H Key shared between the users.
Ans-
UNIT - III
Block ciphers and Data encryption standards
2 Marks:

1. Define Stream cipher.

Ans-“A stream cipher is an encryption technique that works byte by byte to


transform plain text into code that's unreadable to anyone without the proper key. ”
• Stream ciphers are linear, so the same key both encrypts and decrypts
messages.

2. List types of stream cipher.


• Ans-Synchronous Stream Ciphers
• Self-Synchronizing/Asynchronous stream Ciphers

3. Define Block Cipher.


Ans-“A block cipher is a symmetric cryptographic technique which we used
to encrypt a fixed-size data block using a shared, secret key.

4. List examples of stream and block ciphers.


• Ans-stream cipher- River Cipher (RC4), Salsa20, Software-Optimized
Encryption Algorithm (SEAL)

• Block ciphers- Data Encryption Standard (DES), TripleDES, Advanced


Encryption Standard (AES) , Two fish

5. List various modes of operation of a Block Cipher.


Ans-Various modes of operation of a Block Cipher:

❖ Electronic Code Book (ECB) Mode


❖ Cipher Block Chaining (CBC) Mode
❖ Cipher Feedback (CFB) Mode
❖ Output Feedback (OCB) Mode
❖ Counter (CTR) Mode

4 Marks:
1. Explain Advantages and Disadvantages of stream cipher.

Ans- Advantages of Stream Ciphers


• Stream ciphers have many advantages, such as:
• Speed: Generally, this type of encryption is quicker than others, such as block
ciphers.
• Low complexity: Stream ciphers are simple to implement into contemporary
software, and developers don’t require sophisticated hardware to do so.
• Sequential in nature: Certain companies handle communications written in a
continuous manner. Stream ciphers enable them to transmit data when it’s ready
instead of waiting for everything to be finished because of their bit-by-bit
processing.
• Accessibility: Using symmetrical encryption methods like stream ciphers saves
businesses from having to deal with public and private keys. Additionally,
computers are able to select the appropriate decryption key to utilize thanks to
mathematical concepts behind current stream ciphers.
Disadvantages of Stream Ciphers
• If an error occurs during transmission, it can affect subsequent bits, potentially
corrupting the entire message because stream ciphers rely on previously stored
cipher bits for decryption
• Maintaining and properly distributing keys to stream ciphers can be difficult,
especially in large systems or networks.
• Some stream ciphers may be predictable or vulnerable to attack if their key
stream is not properly designed, potentially compromising the security of the
encrypted data.

2. Write differences between Stream and block ciphers.


Ans-

3. Write a note on Stream Cipher.


Ans- “A stream cipher is an encryption technique that works byte by byte to
transform plain text into code that's unreadable to anyone without the proper
key. ”
• Stream ciphers are linear, so the same key both encrypts and decrypts messages.
Stream ciphers rely on:
• Plaintext. You must have a message you'd like to encode.
• Keystreams. A set of random characters replaces those in the plaintext. They
could be numbers, letters, or symbols.
• Ciphertext. This is the encoded message.
Encryption
• For Encryption,
• Plain Text and Keystream produces Cipher Text (Same keystream will be used
for decryption.).
• The Plaintext will undergo XOR operation with key stream bit-by-bit and
produces the Cipher Text.
Decryption
For Decryption,
• Cipher Text and Keystream gives the original Plain Text (Same keystream will
be used for encryption.).
• The Ciphertext will undergo XOR operation with keystream bit-by-bit and
produces the actual Plain Text.

4. Write a note on Block Cipher.


Ans- “A block cipher is a symmetric cryptographic technique which we used
to encrypt a fixed-size data block using a shared, secret key.
During encryption, we used plaintext and ciphertext is the resultant encrypted text.
It uses the same key to encrypt both the plaintext, and the ciphertext. “
• A block cipher processes the data blocks of fixed size. Typically, a message's
size exceeds a block's size. As a result, the lengthy message is broken up into a
number of sequential message blocks, and the cipher operates on these blocks
one at a time.

5. Explain ECB mode with a neat diagram.


Ans- ECB mode stands for Electronic Code Block Mode. It is one of the simplest
modes of operation. In this mode, the plain text is divided into a block where
each block is 64 bits. Then each block is encrypted separately. The same key is
used for the encryption of all blocks. Each block is encrypted using the key and
makes the block of ciphertext

6. Explain Cipher Block Chaining Mode with a neat diagram.


• Ans- CBC Mode stands for Cipher block Mode at the sender side; the plain text
is divided into blocks. In this mode, IV(Initialization Vector) is used, which can
be a random block of text. IV is used to make the ciphertext of each block
unique.
• Cipher block chaining or CBC is an advancement made on ECB since ECB
compromises some security requirements.

8 Marks:

1. Solve the problem P=‘RLS BCA’, Key=’E’ using stream cipher. Perform
Encryption and Decryption.
2. Solve the problem P=‘KIWI’, Key=’D’ using stream cipher. Perform
Encryption and Decryption.

3. Solve the problem P=‘APPLE’, Key=’F’ using stream cipher. Perform


Encryption and Decryption.
4. Solve the Problem using RC4’s PRGA Algorithm. Consider S= [2, 3, 7, 4, 6,
0, 1, 5], P= [1,2,2,2], K= [5,1,0,1] and perform Encryption and Decryption.
Ans-
5. Explain various modes of operation of a Block Cipher.
1. Ans- Electronic Codebook Mode
• ECB mode stands for Electronic Code Block Mode. It is one of the simplest
modes of operation. In this mode, the plain text is divided into a block where
each block is 64 bits. Then each block is encrypted separately. The same key is
used for the encryption of all blocks. Each block is encrypted using the key and
makes the block of ciphertext.
• At the receiver side, the data is divided into a block, each of 64 bits. The same
key which is used for encryption is used for decryption. It takes the 64-bit
ciphertext and, by using the key convert the ciphertext into plain text.
2. Cipher Block Chaining Mode (CBC)
• CBC Mode stands for Cipher block Mode at the sender side; the plain text is
divided into blocks. In this mode, IV(Initialization Vector) is used, which can
be a random block of text. IV is used to make the ciphertext of each block
unique.
• Cipher block chaining or CBC is an advancement made on ECB since ECB
compromises some security requirements.
• In CBC, previous cipher block is given as input to next encryption algorithm
after XOR with original plaintext block. In a nutshell here, a cipher block is
produced by encrypting a XOR output of previous cipher block and present
plaintext block.

3. Ciphertext Feedback Mode (CFB)


• CFB mode stands for Cipher Feedback Mode. In this mode, the data is
encrypted in the form of units where each unit is of 8 bits.
• Like cipher block chaining mode, IV is initialized. The IV is kept in the shift
register. It is encrypted using the key and form the ciphertext.
• CFB also uses an IV, similar to CBC.
• In CFB mode, the previous ciphertext block is encrypted, and the output
is XORed with the current plaintext block to create the current ciphertext block.
Advantage of CFB:
Since, there is some data loss due to use of shift register, thus it is difficult for
applying cryptanalysis.
4. Output Feedback Mode (OFB)
• OFB Mode stands for output feedback Mode. OFB mode is similar to CFB
mode; the only difference is in CFB, the ciphertext is used for the next stage of
the encryption process, whereas in OFB, the output of the IV encryption is used
for the next stage of the encryption process.
• The IV is encrypted using the key and form encrypted IV. Plain text and
leftmost 8 bits of encrypted IV are combined using XOR and produce the
ciphertext.
• For the next stage, the ciphertext, which is the form in the previous stage, is
used as an IV for the next iteration. The same procedure is followed for all
blocks.
• In this output feedback mode, all bits of the block are send instead of sending
selected s bits.
• 5. Counter Mode (CTR)
• CTR Mode stands for counter mode. As the name is counter, it uses the
sequence of numbers as an input for the algorithm. When the block is
encrypted, to fill the next register next counter value is used.
Note: the counter value will be incremented by 1.
• For encryption, the first counter is encrypted using a key, and then the plain text
is XOR with the encrypted result to form the ciphertext.
• The counter will be incremented by 1 for the next stage, and the same procedure
will be followed for all blocks. For decryption, the same sequence will be used.
Here to convert ciphertext into plain text, each ciphertext is XOR with the
encrypted counter. For the next stage, the counter will be incremented by the
same will be repeated for all Ciphertext blocks.

You might also like