如何从RSA模数创建PEM格式的RSA公钥?

时间:2021-10-21 18:24:30

I have the modulus of an RSA public key. I want to use this public key with the Python library "M2Crypto", but it requires a public key in PEM format.

我有RSA公钥的模数。我想将此公钥与Python库“M2Crypto”一起使用,但它需要PEM格式的公钥。

Thus, I have to convert the RSA modulus to a PEM file.

因此,我必须将RSA模数转换为PEM文件。

The modulus can be found here.

模数可以在这里找到。

Any ideas?

1 个解决方案

#1


The M2Crypto library has a way to reconstruct a public key. You need to know the public exponent, e (often 65337 for RSA keys, but other numbers such as 3 or 17 have been used), and the modulus, n (which is the 512-bit number provided in the question). Note that the docs describe the length-encoded format used for e and n.

M2Crypto库有一种重建公钥的方法。您需要知道公共指数e(对于RSA密钥通常为65337,但已使用其他数字,如3或17),以及模数n(在问题中提供的512位数)。请注意,文档描述了用于e和n的长度编码格式。

Once the public key has been reconstructed, it can be saved into a file and used again later without the hassle of conversion.

重建公钥后,可将其保存到文件中,以后再使用,无需转换麻烦。

#1


The M2Crypto library has a way to reconstruct a public key. You need to know the public exponent, e (often 65337 for RSA keys, but other numbers such as 3 or 17 have been used), and the modulus, n (which is the 512-bit number provided in the question). Note that the docs describe the length-encoded format used for e and n.

M2Crypto库有一种重建公钥的方法。您需要知道公共指数e(对于RSA密钥通常为65337,但已使用其他数字,如3或17),以及模数n(在问题中提供的512位数)。请注意,文档描述了用于e和n的长度编码格式。

Once the public key has been reconstructed, it can be saved into a file and used again later without the hassle of conversion.

重建公钥后,可将其保存到文件中,以后再使用,无需转换麻烦。