question archive Consider PKCS-2

Consider PKCS-2

Subject:Computer SciencePrice:3.87 Bought7

Consider PKCS-2.1 with n = 1024 bit and SHA-1 . Assuming L is an empty string and PS is of 8 bytes, then describe in step-by-step that in one go maximum bytes of data can be encrypted. Now, if the modulus n is increased from 1024 bit to 2048 bit then approximately how slow/fast will be the encryption, if maximum allowed bytes are encrypted.

 

pur-new-sol

Purchase A New Answer

Custom new solution created by our subject matter experts

GET A QUOTE

Answer Preview

Answer:

Maximum byte of data encryption for n=1024 in SHA-1:

Maxlength =  keylenbit / 8  -  2 * hashlenbit / 8  -  2  

SHA-1 gives output of size 160 byte.  Hashlenbit  = 256 can be used for the calculation.

Put the value of keylenbit=1024 and Hashlenbit =256 for 1024 module encryption

Maxlength = 1024 / 8 -2 * 256 / 8 - 2

                  = 128 -  64 - 2

                  =  62

Maximum byte of data encryption for n=2048 in SHA-1:

Maxlength =  keylenbit / 8  -  2 * hashlenbit / 8  -  2   

Maxlength =  keylenbit / 8  -  2 * hashlenbit / 8  -  2  

Put the value of keylenbit =2048 and hashlenbit= 256  for 1024 module encryption

Maxlength = 2048 / 8 -2 * 256 / 8 - 2

                  = 256 -  64 - 2

                  =  190

For processing large amounts of data slow down the encryption approximately half of the normal encryption  because large overhead is involved for both encryption and decryption.

Step-by-step explanation

PKCS 1 stands for Public Key Cryptography Standards. It used to encrypt the message for SHA-1. Below is the encryption calculation shown for the PKCS 2.1 version.  It gives a standard definition for RSA algorithm for PKC 1. Latest version for PKCS 1 is 2.2.

Maximum byte of data encryption for n=1024 in SHA-1:

Maximum length of the byte can be calculated as shown in the following steps.

Step1: Identify the Input length of message M.

To encrypt the message maximum length for the octant could be maxlength.

Where Maxlength  ≤  k - 2*hashlength - 2-------eq1.

To calculate the maximum message size we can rewrite the eq1 as below

 

Maxlength  =  k - 2*hashlength - 2 ---------eq2.

 

Where       k = octant length of RSA module of n bit.

Hashlength = octant length of hash in hash function.

Maxlength = maximum octant length for message M.

Step 2: calculate the key factor for k

k = ceil(keyLenbit / 8)

where keyLenbit =  key size in bits.

Since k is multiple of 8 bit therefore we can rewrite k as below

k = keyLenbit / 8

similarly,  hashlength which is practically always the hash output in bits -

hashlength = hashLenBit / 8   .

step 3. Calculate the maximum length for the message for 1024.

Put the value of k in the eq2 as shown below

Maxlength =  keylenbit / 8  -  2 * hashlenbit / 8  -  2  ----------eq3

Since SHA-1 has an output size of 160. Hashlenbit  =256 can be used for the calculation.

Put the value of keylenbit=1024 and Hashlenbit =256 in eq 3

Maxlength = 1024 / 8 -2 * 256 / 8 - 2

                  = 128 -  64 - 2

                  =  62

Maximum length of the message is 62 byte. Here overhead becomes less and encryption and decryption become faster.

Maximum byte of data encryption for n=2048 in SHA-1:

By the eq3  

Maxlength =  keylenbit / 8  -  2 * hashlenbit / 8  -  2  ----------eq3

Put the value of keylenbit =2048 and hashlenbit= 256

Maxlength = 2048 / 8 -2 * 256 / 8 - 2

                  = 256 -  64 - 2

                  =  190

Therefore the maximum size of message is 190 byte. When we encrypt the message for 2048 bit key, 190 byte of data becomes 256 byte. For processing large amounts of data overhead becomes very high and also decryption becomes very expensive.

References:

RSA Algorithm. Retrieved on November 28, 2020. From URL https://www.di-mgt.com.au/rsa_alg.html 

PKCS #1 hash formats. Retrieved on November 28, 2020. From URL https://www.ibm.com/support/knowledgecenter/linuxonibm/com.ibm.linux.z.wskc.doc/wskc_c_appdpkcs1form.html