Can you please provide an example of how public key authentication works with sftp server? I'm guessing something like:
```
server.PreAuthentication = ServerOnPreAuthentication;
private static void ServerOnPreAuthentication(object sender, PreAuthenticationEventArgs e)
{
e.Accept(AuthenticationMethods.PublicKey);
}
```
And then maybe something like this:
```
server.Authentication = ServerOnAuthentication;
private static void ServerOnAuthentication(object sender, AuthenticationEventArgs e)
{
if (e.Key.???)
{
var user = AddUser((SftpSshServer)sender, e.UserName, e.Password, userPath);
e.Accept(user);
}
else
{
e.Reject();
}
}
```
The problem is e.Key is always null for me, no matter what I do. I am testing this with FileZilla and a Logon Type of Key file where I specify a ppk file.
asked 12/17/2019 8:22:59 PM