Post a reply

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: Using Certificate in winscp.dll getting error SessionOptions.FtpSecure is not enabled

Please post enough code, that allows us to reproduce the problem.

With VB.NET code like this, I'm not getting the exception:
Dim sessionOptions As New SessionOptions
With sessionOptions
    .Protocol = Protocol.Ftp
    .HostName = "example.com"
    .UserName = "user"
    .FtpSecure = FtpSecure.Implicit
    .TlsClientCertificatePath = "C:\certificate"
End With
 
Using session As New Session
    session.Open(sessionOptions)
End Using
cti@pmt.org

Using Certificate in winscp.dll getting error SessionOptions.FtpSecure is not enabled

The real error is:
SessionOptions.TlsClientCertificatePath is set, but neither SessionOptions.FtpSecure nor SessionOptions.Secure is enabled.

I am setting it as you can see here in my log it shows Implicit:
As I change to other options, log shows the change of my options but nothing changes as far as the error is concerned. Cannot connect. I can use the app with the same certificate and other credentials and all is well.

My Log
Connecting - Certificate \\ebill-server-22\fileserver\shareng\911\9112021\id_ed25519-cert.pub Ftpsecure:Implicit Secure: False giveup: False

Connecting - Opening Connection WINSCP
Connecting - Error: SessionOptions.TlsClientCertificatePath is set, but neither SessionOptions.FtpSecure nor SessionOptions.Secure is enabled.
Connecting - Error: SessionOptions.TlsClientCertificatePath is set, but neither SessionOptions.FtpSecure nor SessionOptions.Secure is enabled.
Connecting - Error: SessionOptions.TlsClientCertificatePath is set, but neither SessionOptions.FtpSecure nor SessionOptions.Secure is enabled.

My current code:
.FtpSecure = FtpSecure.Implicit
' .GiveUpSecurityAndAcceptAnyTlsHostCertificate = True
.TlsClientCertificatePath = sublib2025.gblCertificate
 
'.SshHostKeyPolicy = SshHostKeyPolicy.GiveUpSecurityAndAcceptAny
 
write2TxtLogFile("Connecting", "Certificate " + .TlsClientCertificatePath.ToString + " Ftpsecure:" + .FtpSecure.ToString + " Secure: " + .Secure.ToString + " giveup: " + .GiveUpSecurityAndAcceptAnyTlsHostCertificate.ToString)

I must be doing something wrong, just do not know what it is.

Thanks for your help.