常见的RSA符号指数有哪些?
RSA加密/解密指数和RSA签名/检查指数有什么区别吗?
Are there any difference between RSA encryption/decryption exponent and RSA sign/check exponent?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
没有任何。 RSA 公/私对的公钥由指数和模数组成,无论是用于签名还是加密。最常见的指数是 0x10001。
关于 RSA 的维基百科文章非常好。
None. The public key of an RSA public/private pair consists of an exponent and a modulus, whether it's being used to sign or encrypt. The most common exponent is 0x10001.
The Wikipedia article on RSA is pretty good.
用于签名的 RSA 密钥对和用于加密解密的 RSA 密钥对在结构上没有区别。理论上,您可以使用一对来同时进行两者,但这会为新的攻击开辟途径,因此不建议这样做。
另一方面,私有指数和公共指数之间存在差异:
公共指数可以相对较小,这可以缩短密钥大小并加快加密和签名验证的速度。
正如 Charlie Martin 所说,0x10001 = 2^16 + 1 = 65537 是一个常见的选择。
另一方面,私有指数是从公钥和模数分解导出的,并且通常按照模数本身的大小顺序。由于要保密,因此不能太小(否则很容易被猜到),并且还需要满足与公共指数的算术关系,从而自动变大。
这使得简单的签名/解密比相应的公共操作慢,但另一方面,
通过使用模数的分解和
中国余数定理,即分别计算模
p
和q
,而不是模m = p·q
和然后组合结果。
请注意,我们区分公共(加密/验证)和私有(解密/签名)指数,
不在签名/验证和加密/解密指数之间。
There is no structural difference between a RSA key pair used for signing and one used for encryption decryption. In theory, you could use one pair for both, but this opens up ways for new attacks, so it isn't recommended.
On the other hand, there are differences between private and public exponents:
The public exponent can be relatively small, which shortens the key size and speeds up encryption and signature verification.
As Charlie Martin said, 0x10001 = 2^16 + 1 = 65537 is a common choice.
The private exponent, on the other hand, is derived from public key and the modulus' factorization, and usually in the size order of the modulus itself. As it shall stay private, it can't be small (otherwise it is easy to guess), and it also needs to fulfill the arithmetic relation to the public exponent, which makes it automatically large.
This makes naive signing/decryption slower than the corresponding public operations, but on the other hand,
it is possible to speed this up a bit up by using the decomposition of the modulus and the
Chinese Remainder Theorem, i.e. calculating modulo
p
andq
separately instead of modulom = p·q
andthen combining the results.
Note that we distinguish between public (encryption/verification) and private (decryption/signing) exponents,
not between signing/verification and encryption/decryption exponents.
用于签名/验证的 RSA 密钥与用于加密/解密的 RSA 密钥在模数方面没有区别 - 但是 X509 证书中密钥使用扩展的值会有所不同。
总结出于安全考虑,RSA 公共指数应该仅采用 {3, 5, 17, 257 或 65537} 吗?) security.stackexchange.com:
理论上,所有常见的实现都应该允许您使用任何素数 > 2,但是 费马数 - 2^n + 1 形式的数字,例如 3 , 5, 17, 257, 65537 - 已知为素数的通常受到青睐,因为它们可以加快运算一侧的计算速度(加密/解密、签名/验证) - 65537 可能是目前(2020/11)最常用的指数。
但是,您的具体实现可能会限制您在实践中可以使用的最大值。
There is no difference between an RSA key intended for signing/verification versus one intended for encryption/decryption in terms of modulus - however the value of the key usage extension in the X509 certificate will differ.
To summarise the detailed answers to Should RSA public exponent be only in {3, 5, 17, 257 or 65537} due to security considerations?) over at security.stackexchange.com:
In theory, all common implementations should allow you to use any prime > 2, but Fermat numbers - numbers of the form 2^n + 1, e.g. 3, 5, 17, 257, 65537 - that are known to be prime are often favoured because they speed up calculations on one side of the operation (encrypt/decrypt, sign/verify) - and 65537 is probably the most common exponent in use at this point in time (2020/11).
However, your specific implementation may restrict the maximum value you can use in practice.