简体   繁体   English

Plink SSH主机密钥 - > Windows注册表项

[英]Plink SSH Host key -> Windows Registry Entry

I'm trying to figure out how to make the registry entry that plink is making in windows when you choose to accept and store a host key... I want to be able to automate this process within C++ ... Has anyone done this? 当你选择接受并存储主机密钥时,我正在试图弄清楚如何在windows制作plink所做的注册表项...我希望能够在C++自动执行这个过程......有没有人这样做过? My leads are it gives you the RSA2 key fingerprint ... Is that whats getting converted to what is being stored in the registry? 我的潜在客户是它为您提供RSA2 key fingerprint ...是什么原因转换为存储在注册表中的内容? If so - how? 如果是这样 - 怎么样? If not - does anyone know if it's possible to automate that entry without having to accept the host key via user interaction? 如果没有 - 有没有人知道是否可以自动化该条目而无需通过用户交互接受主机密钥?

Rsa2 key fingerprint: Rsa2密钥指纹:

f5:11:17:52:e1:bb:5e:12:ad:ce:ef:cd:c2:d1:4d:5a

Windows Registry Entry: Windows注册表项:

0x10001,0xc81cb48f929a6f09bab2c27050d53050d9051d3999b552bb1a83f525fea280a1f55424ad4d77c778afdebaf9ff09c99517f77f4da191fde40b65ec867325159663708ffdb6e6661b026611a7b88150279edb166febfcbe122da7d0e53263a068f70e7407a0379a89540f59913512d2ed9138ee09239fc02a2ec50bfbfe2e839a5ab1da505c10e6131bbbc1aa2031a619e8c68cf3ea122e610c62c5ae15db31c2691289568fceae4614cea7b64519a98cc36ee00eb42f957d1fececbf78f8cf1f0587ce0eb09e0863f3526a4bf4e96eeee5f67c4dafc87bd1dc78ee81e651694bad22de954c50df8dde6a3c2e9e982ed448892e7091455249dd720da3cca6e231

Any help is much appreciated, I'm not too keen on this portion of the work, I didn't think I'd have to go this deep to auto-accept host keys using plink but they really don't want it to be possible to automate this... 任何帮助都非常感激,我不太热衷于这部分工作,我不认为我必须深入到使用plink自动接受主机密钥,但他们真的不希望它是可以自动化...

The PuTTY FAQ explains why plink itself doesn't offer to automate this process: PuTTY FAQ解释了为什么plink本身不提供自动化此过程的原因:

A.2.9 Is there an option to turn off the annoying host key prompts? A.2.9是否可以选择关闭烦人的主机密钥提示?
No, there isn't. 不,没有。 And there won't be. 而且不会有。 Even if you write it yourself and send us the patch, we won't accept it. 即使您自己编写并向我们发送补丁,我们也不会接受。
... Host key checking is your guarantee that the encryption you put on your data at the client end is the same encryption taken off the data at the server end; ...主机密钥检查可以保证您在客户端对数据进行的加密与从服务器端的数据中获取的加密相同; it's your guarantee that it hasn't been removed and replaced somewhere on the way. 这是你的保证,它在途中没有被移除和替换。

It's important to understand this reasoning before proceeding. 在继续之前理解这个推理很重要。 However, it goes on to mention two things: 然而,它继续提到两件事:

  1. the -hostkey option, which allows you to specify a known host key on the command-line when running plink -hostkey选项,允许您在运行plink时在命令行上指定已知的主机密钥
  2. A Python script for converting OpenSSH .known_hosts files into a .reg file. 用于将OpenSSH .known_hosts文件转换为.reg文件的Python脚本。

The link to the Python script from the FAQ is broken, but you can find it in the current git viewer as contrib/kh2reg.py . FAQ中的Python脚本链接已断开,但您可以在当前的git查看器中找到它作为contrib / kh2reg.py

The script performs various transforms on the key (probably similar to the difference between standard PEM files and PuTTY's PPK format), and then uses a function winmungestr to format it for the registry, which percent-encodes non-printable characters, spaces, and any of \\*?%~ 该脚本对密钥执行各种转换(可能类似于标准PEM文件和PuTTY的PPK格式之间的差异),然后使用函数winmungestr为注册表设置格式,对不可打印的字符,空格和任何其他字符串进行百分比编码of \\*?%~

You could probably adapt that script to your language and context with a bit of effort. 您可以通过一些努力使该脚本适应您的语言和上下文。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM