我可以生成具有负 RSA 密钥模数的 x509 证书吗?

问题描述 投票:0回答:1

到目前为止,我尝试使用

x509
库在 Go 中生成 x509 证书,但这没有成功,因为 Go 不允许生成负模数。

我尝试使用

openssl

openssl req  -nodes -new -x509  -keyout server.key -out server.cert

但它生成正模 RSA 密钥。 出于教育目的,我仍然需要负 RSA 模数,是否可以使用

openssl

go openssl rsa x509certificate modulo
1个回答
0
投票

具有负模数的 RSA 密钥不是 RSA 密钥。

根据 RFC 8017(加粗我的):

3.1。 RSA 公钥

就本文档而言,RSA 公钥包括 两个组成部分:

     n        the RSA modulus, a positive integer
     e        the RSA public exponent, a positive integer

在有效的 RSA 公钥中,RSA 模数 n 是 u 的乘积 不同的奇素数 r_i, i = 1, 2, ..., u,其中 u >= 2,并且 RSA 公共指数 e 是 3 到 n - 1 之间的整数,满足 GCD(e,\lambda(n)) = 1,其中 \lambda(n) = LCM(r_1 - 1, ..., r_u - 1)。 按照惯例,前两个素数 r_1 和 r_2 也可以表示为 p 和 q 分别。

。 。 .

3.2。 RSA 私钥

就本文档而言,RSA 私钥可能具有 两种表示之一。

  1. 第一个表示由 (n, d) 对组成,其中 各组成部分的含义如下:

     n       the RSA modulus, a positive integer
     d       the RSA private exponent, a positive integer
    
  2. 第二个表示由五元组 (p, q, dP, dQ, qInv) 和一个(可能为空)三元组序列 (r_i, d_i, t_i), i = 3, ..., u,每个不在五元组中的素数一个, 其中各组成部分的含义如下:

     p      the first factor, a positive integer
     q      the second factor, a positive integer
     dP     the first factor's CRT exponent, a positive integer
     dQ     the second factor's CRT exponent, a positive integer
     qInv   the (first) CRT coefficient, a positive integer
     r_i    the i-th factor, a positive integer
     d_i    the i-th factor's CRT exponent, a positive integer
     t_i    the i-th factor's CRT coefficient, a positive integer
    

规定的所有值均为正整数,模数是两个或多个质数的乘积。

所有素数定义为:

质数(或质数)是大于 1 的自然数,且不是两个较小自然数的乘积。

因此,任何质数的乘积也必须大于零,这使得 RSA 密钥的负模在数学上是不可能的。

© www.soinside.com 2019 - 2024. All rights reserved.