Post a reply

Before posting, please read how to report bug or request support effectively.

Bug reports without an attached log file are usually useless.

Add an Attachment

If you do not want to add an Attachment to your Post, please leave the Fields blank.

(maximum 10 MB; please compress large files; only common media, archive, text and programming file formats are allowed)


Topic review


Re: WinSCP dll SshPrivateKeyPath

The host key is not used for authentication.

Don't you have your key loaded to Pageant?

If you want us to investigate further, please attach a full session log file showing the problem (using the latest version of WinSCP).

To generate the session log file, set Session.SessionLogPath. Submit the log with your post as an attachment. Note that passwords and passphrases not stored in the log. You may want to remove other data you consider sensitive though, such as host names, IP addresses, account names or file names (unless they are relevant to the problem). If you do not want to post the log publicly, you can mark the attachment as private.

WinSCP dll SshPrivateKeyPath

I'm trying to configure my application to use Host client PPK authentication so;
1. The host checks that it can find a matching host public key (fingerprint) on the client and
2. The client has generated a Private/Public key pair and placed it's public key onto the host.
I've supplied the path of the private client ppk file to the SshPrivateKeyPath attribute.
Here's my code;
lvoSessionOptions           = NEW WinSCP.SessionOptions().

lvoTransferOptions          = NEW WinSCP.TransferOptions().
lvoRemoteFileInfoCollection = NEW WinSCP.RemoteFileInfoCollection().
lvoTransferOptions:TransferMode = TransferMode:BINARY.

  lvoSessionOptions:HostName              = SFTP_Host
  lvoSessionOptions:UserName              = lvcUsername
  lvoSessionOptions:Protocol              = Protocol:Sftp
  lvoSessionOptions:PortNumber            = SFTP_Port.
  /* If password is provided, uses standard user/pwd auth else uses PPK */
  IF lvcPassword NE "" THEN
    lvoSessionOptions:Password = lvcPassword.
  /* The path to the clients local private pk file (ppk) - from which the public key is sent to the host */
  IF SFTP_ClientPrivateKeyFile NE "" THEN
    lvoSessionOptions:SshPrivateKeyPath = SFTP_ClientPrivateKeyFile.     
  /* the host SFTP server's "fingerprint" */
  lvoSessionOptions:SshHostKeyFingerprint = SFTP_HostPublicKey.
  /* If the client's local Private/Public key pair is encrypted we'll need this */
  IF SFTP_ClientPrivateKeyPassword NE "" THEN
    lvoSessionOptions:PrivateKeyPassphrase  = SFTP_ClientPrivateKeyPassword.
SFTPClient = NEW WinSCP.Session().

The issue seems to be that no notice is paid by the SFTP server of the Clients private key location, it can be anything or blank, but the client still connects via the Hosts public key fingerprint matching that of the clients.
I'm using the Bitvise SFTP server.
Have I made a mistake in the code or in the configuration of the server?
Does WinSCP perform both client and host public key comparisons?