怎么验证id_rsa.pub和id_rsa是否匹配
比如下面这对我刚刚生成的,这个id_rsa:
-----BEGIN RSA PRIVATE KEY-----
MIIEpAIBAAKCAQEA8jXTK4q+ipnrgsHoaIrzkFmRXCdpfUy7pxrjW1LbwC7kBg9n
FTPTchbiieFPC7CPxHG5BQYZqwa/xY7PyHDw6CoTemEgn9doN+9DEgiN7Kkehh40
iprlnW7m+fO7OrpmiNaYzJ0Oeq3JTRWrhgJG2h1xHrbDnRPYGe7CSjvQpIzYC360
8njzJGM/9DHlGXLtAyK8jxzAT2eYPp+9w8lxdtoj2ZlytcHSIm4znWSA3mu9SwSt
JTyu0dBGDBlRFVevjZrG4TBmowRfA4ssFLoRneaT+OO71GHN1hXU0TAYDY72l7gc
lImFb3mIPagQ9pq9oFRlOqmAH6E160nALjEvSQIDAQABAoIBAQDZjzVuMAL01krw
OaK7fMxIhduGjjQ4A1uvPvynhCa1WqkhNGagadvs59d2h/YLhv2sM4ZAl/koYTiS
iLPk1GXf9CNo0qOOT9tiGr0BDsQEpugvCiSht362Se6Y56/ukY4WLcQ0ToK5+S4O
2n8mMRdZRgbc0sekaTW8HXVRXqcLlWP0tL+7l5VyIESutnwxa0ZwZ01eRFD7+Mjp
tFKmk2qoswGr5XX2Bja9IzHT/NwWlBJINi74dnAsI8bdgcGmgEAU1/0qVoPr3MO6
EZ+vBDPEDdH50Zt1qVlc3/aNww1eGj2P/Re2y4laCvrjEWa4UBCNRwfrLun+BhhL
hTj9fS+BAoGBAP15whzcbveGMXW4wnEio0m+eKgDznO6QDpUB/qEhMI8KdxPPWK2
arHmRYuNG4HuHzAJN/vwH+6q/3oGBo32RaRrCy+/Gubo+y4KcHKCM2MdiLtTC86r
HOLTaeJ544XidAeXqotV6BNbp2nRwaRSwKY8wCUWkaIaibeStDKE9DTZAoGBAPSf
WGejneBRSZZdQVEu1IJPZxRZsAUGxWtuJro8pUvNbUI6BzxV5ddQIhF3/Nbuqcb+
oE7GNBQ92NVgcVWl8+8vWJUgfmP5t2+Xis2KCasEVi7/t6BzqQ6yEv5d2Z+P3StT
WMfp6kqfalXZ1PF0BmAqGCTfh+9KCF8Vk2p3tYfxAoGAbxNfM+SJICEHJY5MbuV9
5r/4AbCBVQdmQ+k1Adv2jWNt+KQkw1Aq20CMc0Xnqv1dX2B6zwWACMeYYrGnR6iH
BjD+WvME5/FquNdMRXG28RUtKOGQiAVGCEQa32sIgFAnBni4/IwtweXlLCMGF2tI
DtEKZnZIZV/5v58jJgxLM6kCgYA4WsVJCv6CAPgM9eroQvueEaDTpV3Rqp+sgjHV
0cba0baL/UZRdhB/K+zNTXEoKs9eEqbnvu2chCsB7Tfu3U53Gdc0c8nqSksiIC1P
8K8NgPBB35N0GXEm+4s4onJSOhhftNHNLGxXSKZ8pLRT88DMQqZRSFXOoKWREi1l
57IgYQKBgQD8xA1CwhvsOoeN48dOp2ADxE4aByzdxh8U3t8QOgy/g8KBSDUGfjxE
4kuQ2OdfCIAg924sW0/BnmH2B4xyNa5ELtfSC4aAvnpJRWhloMpxxCe+RNiD0azG
yCaxhG5EINfS8F/amPFL0LR5guZv+GlE81GDT4KUsdKlqlFZtoBpzg==
-----END RSA PRIVATE KEY-----
id_rsa.pub:
ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQDyNdMrir6KmeuCwehoivOQWZFcJ2l9TLunGuNbUtvALuQGD2cVM9NyFuKJ4U8LsI/EcbkFBhmrBr/Fjs/IcPDoKhN6YSCf12g370MSCI3sqR6GHjSKmuWdbub587s6umaI1pjMnQ56rclNFauGAkbaHXEetsOdE9gZ7sJKO9CkjNgLfrTyePMkYz/0MeUZcu0DIryPHMBPZ5g+n73DyXF22iPZmXK1wdIibjOdZIDea71LBK0lPK7R0EYMGVEVV6+NmsbhMGajBF8DiywUuhGd5pP447vUYc3WFdTRMBgNjvaXuByUiYVveYg9qBD2mr2gVGU6qYAfoTXrScAuMS9J vagrant@ubuntu
我看到网上的在线验证工具,公钥要求都是
以“-----BEGIN PUBLIC KEY-----”开头 “-----END PUBLIC KEY-----” 结尾
和我这个id_rsa.pub不一样,所有验证失败
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
这种格式的需要使用openssl生成
至于验证id_rsa.pub和id_rsa是否匹配的方法如下:
然后比较id_rsa.pub.tobecompared 与 id_rsa.pub 的内容是否一致
这个是因为ssh公钥的格式不一样
详情见这个:https://www.cnblogs.com/ifant...