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.

Options
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)

Options

Topic review

martin

Re: error in generated c# code (mistake between Password and PrivateKeyPassphrase)

OK, I see now. I can reproduce the problem if I have "Remember password for duration of the session" option turned on.
Thanks for your report.

Same problem:
https://winscp.net/forum/viewtopic.php?t=26793
Guest

Re: error in generated c# code (mistake between Password and PrivateKeyPassphrase)

martin wrote:

Please attach a full session log file showing the problem (using the latest version of WinSCP).

To generate the session log file, enable logging, log in to your server and do the operation and only the operation that causes the error. 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.


See attached file
martin

Re: error in generated c# code (mistake between Password and PrivateKeyPassphrase)

Please attach a full session log file showing the problem (using the latest version of WinSCP).

To generate the session log file, enable logging, log in to your server and do the operation and only the operation that causes the error. 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.
Guest

Re: error in generated c# code (mistake between Password and PrivateKeyPassphrase)

martin wrote:

How did you "entered the PrivateKeyPassphrase property in WINSCP GUI to test connection using GUI"?

during connection phase in GUI, a progess window is displayed.
Once authentication is addressed, the progress stops and I'm invited to enter passphrase in a popup.
ps this SFTP connection requires username and private key, no password is used.

[img][/img]
martin

Re: error in generated c# code (mistake between Password and PrivateKeyPassphrase)

How did you "entered the PrivateKeyPassphrase property in WINSCP GUI to test connection using GUI"?
Guest

Re: error in generated c# code (mistake between Password and PrivateKeyPassphrase)

Anonymous wrote:

martin wrote:

WinSCP will never really generates PrivateKeyPassphrase property, as a key passphrase is not part of stored session settings. It's always prompted for during authentication only.
If Password property was generated, then it's most probably because you entered a key passphrase as a password on WinSCP login dialog. But password is never (code nor GUI) used to decrypt a key.
If my conclusions are wrong, please let me know.

well... I did not invent this...
I entered the PrivateKeyPassphrase property in WINSCP GUI to test connection using GUI.
Once this worked I clicked the generate code option.
What I got is what I explained.
So I invite you to test this scenario for yourself: running v 5.13.4.8731 here.

as a side note: the generated code contained the CORRECT passphrase value, but referred to the WRONG session parameter.
Guest

Re: error in generated c# code (mistake between Password and PrivateKeyPassphrase)

martin wrote:

WinSCP will never really generates PrivateKeyPassphrase property, as a key passphrase is not part of stored session settings. It's always prompted for during authentication only.
If Password property was generated, then it's most probably because you entered a key passphrase as a password on WinSCP login dialog. But password is never (code nor GUI) used to decrypt a key.
If my conclusions are wrong, please let me know.

well... I did not invent this...
I entered the PrivateKeyPassphrase property in WINSCP GUI to test connection using GUI.
Once this worked I clicked the generate code option.
What I got is what I explained.
So I invite you to test this scenario for yourself: running v 5.13.4.8731 here.
martin

Re: error in generated c# code (mistake between Password and PrivateKeyPassphrase)

WinSCP will never really generates PrivateKeyPassphrase property, as a key passphrase is not part of stored session settings. It's always prompted for during authentication only.
If Password property was generated, then it's most probably because you entered a key passphrase as a password on WinSCP login dialog. But password is never (code nor GUI) used to decrypt a key.
If my conclusions are wrong, please let me know.
kwenix

error in generated c# code (mistake between Password and PrivateKeyPassphrase)

I was able to connect using WinSCP, so I copied c# code into project which would fail because of authentication issues ?!

When researching logs and doc I found mistake in generated c# code:

SessionOptions sessionOptions = new SessionOptions
{
Protocol = Protocol.Sftp,
HostName = "blablalab.com",
PortNumber = 22,
UserName = "whatever",
Password = "complicatedpassword",
SshHostKeyFingerprint = "dont care",
SshPrivateKeyPath = @"C:\temp\my_private_key.ppk",
};

should have been

SessionOptions sessionOptions = new SessionOptions
{
Protocol = Protocol.Sftp,
HostName = "blablalab.com",
PortNumber = 22,
UserName = "whatever",
PrivateKeyPassphrase = "complicatedpassword",
SshHostKeyFingerprint = "dont care",
SshPrivateKeyPath = @"C:\temp\my_private_key.ppk",
};

After correcting, c# code now runs fine...
Now you just need to correct in WinSCP for future usage !?