1

我正在使用 C#(.NET 程序集)开发 SFTP WinSCP 客户端。在我的测试环境中,我通过密码验证来做到这一点。这是我的会话选项:

// Setup session options
SessionOptions sessionOptions = new SessionOptions {
    Protocol = Protocol.Sftp,
    HostName = "example.com",
    UserName = "user",
    Password = "mypassword",
    SshHostKeyFingerprint = "ssh-rsa 2048 xx:xx:xx:xx:xx:xx:xx:xx:xx:xx:xx:xx:xx:xx:xx:xx"
};

但真实环境没有用户密码。服务器管理员提供扩展名为“.crt”的公钥

那么使用此公钥如何更改我的程序(SessionOptions)?

这些细节是否足以进行此实施?

crt文件预览

在此处输入图像描述

4

1 回答 1

1

From the extension, look and size of the the file you received, I believe it is a public key of the server in form of a certificate.

First, server's public key can be used only to verify that the server you connected to is actually the one you wanted to connect to (i.e. there's no man-in-the-middle attack ongoing).

Second, certificate format of keys is never used with SSH. It's used with TLS/SSL, so for example with FTPS (FTP over TLS/SSL), or HTTPS.

I'd say that there's some great misunderstanding between you and the server admin.

If you want more details, you should better ask on SuperUser or ServerFault, as this does not look like a programming question in the end.

于 2014-09-19T08:49:28.743 回答