encryption - ssh-keygen 和 openssl 给出两个不同的公钥

标签 encryption openssl rsa ssh-keys key-pair

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/

相关文章:

go - 如何使用 Go Golang 对文件进行签名

php - openssl:如何从模数中获取公钥

c - 如何使这个转置算法读取整个文本文件

google-cloud-platform - GCP KMS 导入以太坊钱包私钥

c++ - 如何使用 BCrypt 进行 RSA(非对称加密)

tomcat - 无法使用 key 、证书和 CA 证书链长度 : 1 为 Tomcat 创建 keystore

php openssl : how to match the private key with the certificate

math - 部分密文的RSA加密和解密?

javascript - 当 URL 中包含 Angularjs 数据时,如何加密我的 URL?

java - 避免在加密和编码的 URL 字符串中换行