RSA function generates public key (e) always to 17

我们两清 提交于 2020-01-16 04:35:20

问题


I've been working on a project based on RSA key exchange and I have used Crypto++ Library. I followed the guidelines in https://www.cryptopp.com/wiki/Raw_RSA and my project works fine. However, I noticed that the public key is always fixed to 1710 = 1116 and when I looked in the rsa.cpp in Crypto++ that public key is fixed!

Again, my project works fine, but I just want to know why..


回答1:


I noticed that the public key is always fixed to 1710 = 1116 and when I looked in the rsa.cpp in Crypto++ that public key is fixed!
... my project works fine, but I just want to know why..

That's the public exponent, and you can change it. See InvertibleRSAFunction Class Reference.

InvertibleRSAFunction is an odd name if you are not familiar with the library, but there's a type define for typedef InvertibleRSAFunction PrivateKey in rsa.h. RSA::PrivateKey's Initialize function that takes the RandomNumberGenerator is the one that creates keys:

void Initialize (RandomNumberGenerator &rng, unsigned int modulusBits, const Integer &e=17)

The only requirement for the public exponent (e) is it must be co-prime or relatively prime to phi. Phi is Euler's Φ-function, and it's defined as (p-1)*(q-1). It ensures there's an inverse (the private exponent, d).

The public exponent is usually selected for a low-hamming weight to make public key operations faster. A low hamming weight means it has very few 1's, and typical values are 3 (0x3), 17 (0x11) and 65537 (0x10001). Fewer 1's makes the exponentiation fast for the public key operations.

For completeness, the public key is {n,e}. The private key is {n,e,d}. Private keys with CRT parameters are {n,e,d,p,q,dp,dp,u}.



来源:https://stackoverflow.com/questions/36555930/rsa-function-generates-public-key-e-always-to-17

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!