你能用ppk文件中的私钥签名吗?

时间:2015-12-17 22:12:30

标签: c#

我使用PuttyGen创建公钥/私钥对作为.ppk文件,但我在代码中实际使用它时遇到了麻烦。在记事本中打开随机生成的ppk文件显示:

PuTTY-User-Key-File-2: ssh-rsa
Encryption: aes256-cbc
Comment: rsa-key-20151217
Public-Lines: 6
AAAAB3NzaC1yc2EAAAABJQAAAQEAl3m8PRlx/SL7EJrs+hDQbP9mp27XXRY4pztg
v8mxAthI2tMEhF0eyXqFV0/W/M13pPs1hHh3H7wIfAy/XbxF7KPeOeMkThMmF2p1
cwJOcpFuh6TCPT09ScPLCR5bsmQyzvsjPMWahcoDrLhf9MGfc9luQs7k1eMTM1iX
hq6F/ku7mNQ4mgKoOOlXKPhE6dFz9Qhe5k0TE3zIfkXUCCkm+74VqyG5l5vG6/fb
ZmVD0nGM6ErPHB/zQ0WbTm65BMmLIIfNZoVrRwcrQmjj4qJnJg7s+Ar0wfB0Y1kl
91fcxKJ4Mx2uBw7T0T+61DrXKamnqQmTz8g/QsgwwBGLqz9mXQ==
Private-Lines: 14
uvM2bpGRiAQey2PSgAdoQHWn7nv925WBHXx5uSfrUZpx9+HwMjCAy7Y7vDwZUUwT
kYb5PH8acor9aeu7xAaTdUFuYWliHA023pbac9CxdRUE7xMCH8u8rTpo6ZKRKKmS
ExNfEXnk9Veqn2Kr2vbXOd/zc2hiJNrmlMdik1v6RMmOhGfNgHKytlvJbZCF9WDM
gkXpuKBO04cFA241PvJNVC0VdHg+DiNhnqdlUBxW/trR5OieIBgqXLTqeAjGsdt9
066F0DhUCguOrSl5WUlrM3I4ylTqn1Xb9Vr1/7iTnDUaStwGWxjMj9YqgjHjuF/9
Lq0lDdIAriXb9IcvHoU7JWPpOtr5JtGRK0MDAN3YEX4hutPcmFv3F6UHOCFOSBNQ
UTu+Hg+dGzInvN63d0YaZyoEO8n8OpVI8gjrsKsHDgk7crnIyIDi8KKF4skgE4jf
kpVHwW80WBw9zizJlnBFxCnrkigEvI6X+hKTbTM4il5wt7Ixcympgl8EvZc8TaI2
Ksqeg+ONeA2H4Wgi+bzkys111/oTDsC41JfjwWS1lanuKpyYm9SDWTSQf48KV8kH
7fIHQ5O/4RV+f7k19IIWmvCcZTqq9xzjJXtYrjYKbCsptPBq+AQjvXcwkV1DpoGP
q5FKpA0QR4VYlCYqU6h5EdE+EuJpL2r0fEQ1I3pYsH+AUjCvZT1TzB5qvh+0krAw
GI786w9LbuhNUWEGtO8AIS0876bTQq4xLlTlgsZSHG0ElUIHSLlwUQL9RLiN97OZ
sokrwZ/7tFMA4ZK9eOPHXIkgWiF4vnrf1CLN/ePuLKpXsGjYKXnLyQy4cM9tGsEA
cfTBsYqriIvlehgnREdzUiGFxHoJ95WMpK/ESCSwlAAW3EMTs9bZRxyi5hwpmjc8
Private-MAC: 5403e23591ff38245d34db92ef130c86e9789b98

这就是公钥文件中的内容:

---- BEGIN SSH2 PUBLIC KEY ----
Comment: "rsa-key-20151217"
AAAAB3NzaC1yc2EAAAABJQAAAQEAl3m8PRlx/SL7EJrs+hDQbP9mp27XXRY4pztg
v8mxAthI2tMEhF0eyXqFV0/W/M13pPs1hHh3H7wIfAy/XbxF7KPeOeMkThMmF2p1
cwJOcpFuh6TCPT09ScPLCR5bsmQyzvsjPMWahcoDrLhf9MGfc9luQs7k1eMTM1iX
hq6F/ku7mNQ4mgKoOOlXKPhE6dFz9Qhe5k0TE3zIfkXUCCkm+74VqyG5l5vG6/fb
ZmVD0nGM6ErPHB/zQ0WbTm65BMmLIIfNZoVrRwcrQmjj4qJnJg7s+Ar0wfB0Y1kl
91fcxKJ4Mx2uBw7T0T+61DrXKamnqQmTz8g/QsgwwBGLqz9mXQ==
---- END SSH2 PUBLIC KEY ----

显然,我不再使用此密钥,仅用于说明目的。但是如何将此文件读入C#以使用它来签名和验证字符串?

0 个答案:

没有答案