0
$\begingroup$

I came upon a solved exercise that uses a client's RSA key to encrypt a DES key. It has the following phrase:

value of n for RSA key generation has been chosen accordingly so that the DES key can be encrypted.

However it does not go on to explain what the requirements are and why. Could someone point this out to me? Many thanks.

$\endgroup$
1
  • 1
    $\begingroup$ $n>56 {}{}{}{}{}$? $\endgroup$
    – kelalaka
    Feb 11 at 18:27
2
$\begingroup$

A DES key is 56 bits long or 8 ASCII(7 bit) characters. The rsa public key n must be larger than that. However RSA key only barely big enough to hold a DES key would give almost no security at all. Common RSA key lengths today are 2048 or even 4096 bits long. 512bit RSA keys which used to be reasonably common can now be broken in minutes with commercially available cloud services. So big enough to be even remotely secure will be much bigger than the minimal size to encrypt a DES key.

P.s If you want to use OAEP (and you do) you need some extra wiggle room beyond the raw message size but still don't go anywhere near secure key length.

$\endgroup$
2
  • $\begingroup$ Do I go for n>=56 which is the size of a DES key or n>=64 which is the size a DES key needs to be stored? $\endgroup$ Feb 12 at 9:19
  • 1
    $\begingroup$ You don't need to store the parity. Because textbook RSA is insecure, you have to have padding. Either the popular but worse PKCS#1v1.5 padding or the better OAEP padding. PKCS#1v1.5 spends minimum 11 bytes on padding (OAEP more). So 7 bytes of payload and 11 bytes of padding is 18 bytes, 144 bit RSA, broken in 0 seconds on a laptop. $\endgroup$
    – Z.T.
    Feb 12 at 18:39

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.