如何从RSA模数创建PEM格式的RSA公钥? [英] How can I create a RSA public key in PEM format from an RSA modulus?
问题描述
我有一个RSA公钥的模数。我要将此公钥与 Python库M2Crypto配合使用,但它需要PEM格式的公钥。
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模数转换为PEM文件。
Thus, I have to convert the RSA modulus to a PEM file.
a href =http://paste.pocoo.org/show/118040/ =nofollow noreferrer>此处。
The modulus can be found here.
任何想法?
推荐答案
M2Crypto库有重新构建公钥的方法。您需要知道公共指数 e
对于RSA密钥通常是65337,但是已经使用了诸如3或17的其他数字)和模数 n
(这是问题中提供的512位数) 。请注意,文档描述了用于 e
和 n
的长度编码格式。
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
.
一旦重建了公共密钥,就可以保存到文件中,稍后再次使用,无需转换麻烦。
Once the public key has been reconstructed, it can be saved into a file and used again later without the hassle of conversion.
这篇关于如何从RSA模数创建PEM格式的RSA公钥?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!