本文介绍了ssh-keygen和openssl提供了两个不同的公钥的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

ssh-keygen& openssl可以从同一私钥生成两个不同的公钥吗?命令ssh-keygen -y -f ./my.key为(同一行中ssh-rsa之后的内容)与使用命令openssl rsa -in my.key -pubout生成的公钥(-----BEGIN PUBLIC KEY----------END PUBLIC KEY-----之间的内容)提供不同的公钥.

Is it possible that ssh-keygen & openssl can generate two different public keys from same private key? Command ssh-keygen -y -f ./my.key gives (contents after ssh-rsa in the same line) different public key to the one generated (contents between -----BEGIN PUBLIC KEY----- and -----END PUBLIC KEY-----) with command openssl rsa -in my.key -pubout .

推荐答案

它是相同的键,但表示形式不同. OpenSSL使用ASN.1中的X.509 SubjectPublicKeyInfo,通常(包括此处)包装在PEM中; OpenSSH(除了SSHv1的'rsa1'密钥已损坏,您不应使用)之外,它在base64中使用类似XDR的SSH有线格式.

It's the same key but different representations. OpenSSL uses X.509 SubjectPublicKeyInfo in ASN.1, usually (including here) wrapped in PEM; OpenSSH (except 'rsa1' keys for SSHv1 which is broken and you shouldn't use) uses the XDR-like SSH wire format, in base64.

重复或接近重复:
将pem密钥转换为ssh-rsa格式
RSA公钥格式
将RSA公钥转换为RSA DER
将OpenSSL生成的RSA公钥转换为OpenSSH格式(PHP)
如何将RSA密钥转换为ssh-rsa
如何存储/检索RSA公钥/私钥(已埋在中间)
和不太明显的跨栈

Dupe or neardupe:
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 (buried in the middle)
and less obvious cross-stack https://security.stackexchange.com/questions/42268/how-do-i-get-the-rsa-bit-length-with-the-pubkey-and-openssl

这篇关于ssh-keygen和openssl提供了两个不同的公钥的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

08-13 13:39