将 rsa 密钥转换为 pem 格式

发布于 2024-12-13 22:32:02 字数 1194 浏览 3 评论 0原文

我有一个十进制格式的 RSA 密钥对,如下所示:

N:  131380300130444423689465024460852313971098730922811994958210650530501686748132880102503190365296216968351535889369502651601697016994057094307459860310817213533755054007252477133258682280599098830508996183566745393684789271087614478241425320061726198137426426490142200235611844869472546908487777450913733956847
E:  65537
D:  80297204963989065579466889768824319637950465647088430322583084471355799970954766200860052948440422519604509972209521777162610037317804551817832746460011635684494412969232268215156141089492528372187753214602862715747188949826914338588271329247689858629892142371556575928454002581316958535707202236560574870513
P:  1224584489781086541356110467036625215751324632060784958572680296867401248241071907258999049522896850209985495153134079568147009917335592949603533318035603
Q:  10728561502026755927334064184961854822182870744919733441933716834397978727498603128211162084788541605856166966893670172798846339557261092973389679407794073

虽然 OpenSSL(对于 PHP)要求密钥应为 PEM 格式。我如何转换它们?公众和公众的参与非常重要。私钥“保持不变”(我的意思是我不能只是创建一个新的密钥对)。

编辑: 或者制作 pem 证书并以十进制格式提取所有这些值是否更容易?如果是这样,怎么办?

I have an RSA keypair in decimal format like this:

N:  131380300130444423689465024460852313971098730922811994958210650530501686748132880102503190365296216968351535889369502651601697016994057094307459860310817213533755054007252477133258682280599098830508996183566745393684789271087614478241425320061726198137426426490142200235611844869472546908487777450913733956847
E:  65537
D:  80297204963989065579466889768824319637950465647088430322583084471355799970954766200860052948440422519604509972209521777162610037317804551817832746460011635684494412969232268215156141089492528372187753214602862715747188949826914338588271329247689858629892142371556575928454002581316958535707202236560574870513
P:  1224584489781086541356110467036625215751324632060784958572680296867401248241071907258999049522896850209985495153134079568147009917335592949603533318035603
Q:  10728561502026755927334064184961854822182870744919733441933716834397978727498603128211162084788541605856166966893670172798846339557261092973389679407794073

While OpenSSL (for PHP) requires that the key should be in PEM format. How do i convert them? It is very important that the public & private key "stays the same" (By that i mean that i can't just make a new keypair).

EDIT:
Or is it easier to make a pem cartificate and extracting all of those values in decimal format? And if so, how?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

我的鱼塘能养鲲 2024-12-20 22:32:02

如果您不需要自己动手(编写一个小型实用程序将密钥转换为 PEM 格式),您可以使用以下 URL 中的 Java 工具: http://www.platanus.cz/blog/converting-rsa-xml-key-to-pem

它要求输入采用 XML 格式文件但是这对你来说应该是微不足道的。

Short of doing it yourself (writing a small utitlity program to convert the key to PEM format) you could use the Java tool at this URL: http://www.platanus.cz/blog/converting-rsa-xml-key-to-pem

It requires the input to be in an XML file but that should be trivial for you to generate.

时光倒影 2024-12-20 22:32:02

monkeyspehere 项目中尝试 ssh2openpgp。

更新:也尝试

Try ssh2openpgp in the monkeyspehere project.

UPDATE: Try also this. It explains how to go from, in two steps, OpenSSH → OpenSSL → GnuPG.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文