简体   繁体   English

如何通过RSA模数以PEM格式创建RSA公钥?

[英]How can I create a RSA public key in PEM format from an RSA modulus?

I have the modulus of an RSA public key. 我具有RSA公钥的模数。 I want to use this public key with the Python library "M2Crypto", but it requires a public key in PEM format. 我想将此公用密钥与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? 有任何想法吗?

The M2Crypto library has a way to reconstruct a public key. M2Crypto库具有一种重构公共密钥的方法。 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). 您需要知道公用指数e (RSA密钥通常为65337,但是使用了其他数字,例如3或17)和模数n (这是问题中提供的512位数字)。 Note that the docs describe the length-encoded format used for e and n . 请注意,文档描述了用于en的长度编码格式。

Once the public key has been reconstructed, it can be saved into a file and used again later without the hassle of conversion. 重建公钥后,可以将其保存到文件中 ,以后再使用,而无需进行转换。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM