ssh-keygen 和 openssl 是否可以从同一个私钥生成两个不同的公钥?命令 ssh-keygen -y -f ./my.key
使用命令 ssh-rsa
为生成的公钥(在 -----BEGIN PUBLIC KEY-----
和 -----END PUBLIC KEY-----
之间的内容)提供(在同一行中 openssl rsa -in my.key -pubout
之后的内容)不同的公钥.
最佳答案
这是相同的键,但表示不同。 OpenSSL 在 ASN.1 中使用 X.509 SubjectPublicKeyInfo,通常(包括这里)包裹在 PEM 中; OpenSSH(SSHv1 的“rsa1” key 除外,该 key 已损坏且您不应使用)在 base64 中使用类似 XDR 的 SSH 有线格式。
欺骗或近乎欺骗:
Convert pem key to ssh-rsa format
RSA Public Key format
Convert RSA public key to RSA DER
Converting an OpenSSL generated RSA public key to OpenSSH format (PHP)
How to convert RSA key to ssh-rsa
How to store/retrieve RSA public/private key (埋在中间)
和不太明显的跨堆栈https://security.stackexchange.com/questions/42268/how-do-i-get-the-rsa-bit-length-with-the-pubkey-and-openssl
关于encryption - ssh-keygen 和 openssl 给出两个不同的公钥,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/46870569/