Can a public key have a different length (encryption) than the private key?

后端 未结 5 964
我寻月下人不归
我寻月下人不归 2021-02-08 23:09

I have a 1024 bits private key, and use it to generate a public key. Does that automatically mean that my public key also has 1024 encryption? Or can it be of a lesser encryptio

5条回答
  •  时光说笑
    2021-02-08 23:37

    From what I understand, there is no requirement that both keys be the same size. Check below for how to generate keys:
    http://en.wikipedia.org/wiki/RSA_algorithm#Key_generation

    However I believe that if one key (or factor of the modulus) is significantly smaller it would weaken the strength against cryptanalysis.

    Edit:

    This discussion has largely become irrelevant since the OP clarified that they were most interested in the size of the modulus, which will naturally be the same for encryption and decryption (excluding any bizarre unknown cryptosystems).

    Just to clarify my point, I am simply saying that if e << d (or d << e) you can distribute the keys as different key sizes. They would be generated by the same algorithm using the same bit-size mathematics (e.g. 256 bits), and similarly encryption and decryption would require the same number of bits. If you look at (for the sake of argument) the numbers 1 and 128, you have a range of choices in how to represent them. They could both be 8 bit, or 1 could be represented by any number of bits from 1-7 bits. This could be considered a cheap trick unless your key generation method guarantees that the magnitudes of d and e would be significantly different in a predictable way. However as stated, I don't see much point to doing this.

提交回复
热议问题