Reputation: 321
I am developing SFTP WinSCP client using C# (.NET Assembly). In my testing environment I did it by password authentication. Here are my session options:
// 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"
};
But real environment don't have password for the user. Server admin provide Public Key with extension ".crt"
So using this Public Key how can I change my program (SessionOptions
)?
Are this details enough to proceed this implementation?
Preview of crt file
Upvotes: 1
Views: 4420
Reputation: 202272
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.
Upvotes: 1