本文介绍了RSA函数生成公钥(e)始终为17的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我一直在开发一个基于RSA密钥交换的项目,我使用了Crypto ++库。我遵循中的指南和我的专案工作正常。但是,我注意到公共密钥总是固定为17 = 11 ,当我在Crypto ++中查看rsa.cpp的公钥是固定的! p>

再次,我的项目工作正常,但我只是想知道为什么..

解决方案

这是公共指数,你可以改变它。请参见。



InvertibleRSAFunction 是一个奇怪的名称,如果你不熟悉库,但有一个类型定义 typedef InvertibleRSAFunction PrivateKey RSA :: PrivateKey 初始化函数接受 RandomNumberGenerator 是创建键的方法:

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

公共指数的唯一要求( e )必须是与 phi 辅助素数或相对素数。 是Euler的Φ函数,定义为(p-1)*(q-1)。它确保有一个逆(私人指数, d )。



公共指数通常选择低-hamming重量,使公钥操作更快。低汉明权重意味着它具有非常少的1,并且典型值是3(0x3),17(0x11)和65537(0x10001)。



为了完整性,公共密钥为 {n,e } 。私钥是 {n,e,d} 。具有CRT参数的私钥是 {n,e,d,p,q,dp,dp,u}

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 17 = 11 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..

解决方案

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}.

这篇关于RSA函数生成公钥(e)始终为17的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

07-25 20:18