【发布时间】:2013-06-04 08:03:02
【问题描述】:
我使用 openssl 生成一对密钥:
shell> ssh-keygen -t rsa
Generating public/private rsa key pair.
Enter file in which to save the key (/Users/mike/.ssh/id_rsa): /path/to/test_rsa
Enter passphrase (empty for no passphrase):
Enter same passphrase again:
Your identification has been saved in /path/to/test_rsa.
Your public key has been saved in /path/to/test_rsa.pub.
然后,我从私钥生成模数:
shell> openssl rsa -in /path/to/test_rsa -noout -modulus > /path/to/modulus.txt
现在,有什么方法可以仅从模数中获取 test_rsa.pub(public key) 吗?
【问题讨论】:
-
也许我错了,它必须使用指数加法。但是,如果我有模数和指数,我可以得到公钥吗?
-
我找到了一个帖子stackoverflow.com/questions/15420259/…,但是它使用了object-c,实际上我想要一个PHP解决方案。
-
一个 RSA 密钥是一对整数
exponent,modulus。因此,答案是否定的,您不能仅从模数创建可用密钥。尽管许多实现确实使用固定的公钥指数,例如65537。 -
@Mike.G 我认为你应该更新你的问题以表明你想要来自模数和指数的公钥。