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

irateb

My apologies for replying to an old post, but the documentation page for
SessionOptions.TlsHostCertificateFingerprint
didn't give an example or specify the format for the fingerprint and had me stuck for a bit. Hopefully this will help someone else like me who ran into this issue after the server changed something and the OP's error started happening to our process. If you can connect via the WinSCP GUI, you can navigate to Session > Server/Protocol Information and the certificate fingerprint will be displayed. What messed me up is, in my case, the server certificate was a wildcard certificate used everywhere in our environment so I grabbed the "thumbprint" (Microsoft's nomenclature for the fingerprint) which has spaces instead of colons in between the byte segments of the fingerprint, and WinSCP kept throwing a "The value supplied is not valid..." error. I also tried no spaces, which didn't work as well. Example usage below:
TlsHostCertificateFingerprint = "00:11:22:33:44:55:66:77:88:99:aa:bb:cc:dd:ee:ff:00:11:22:33"
darkaoui

Re: ERROR: Peer certificate rejected | How do i accept the certificate ?

I confirm that the GiveUpSecurityAndAcceptAnyTlsHostCertificate = true work for me too.

Thanks you for your help
martin

Re: ERROR: Peer certificate rejected | How do i accept the certificate ?

OK, I hope you did notice the GiveUpSecurity... and understand the consequences.
eriock

Re: ERROR: Peer certificate rejected | How do i accept the certificate ?

Thanks Martin but this GiveUpSecurityAndAcceptAnyTlsHostCertificate = true,
did it for me its working now thanks!
eriock

ERROR: Peer certificate rejected | How do i accept the certificate ?

I've just begun using WinSCP today I've successfully connected from WinSCP GUI now I'm trying to automate things using C# .NET and now I'm stuck with this error:
private void button1_Click(object sender, System.EventArgs e)
{
    SessionOptions sessionOptions = new SessionOptions
    {
        Protocol = Protocol.Ftp,
        HostName = "1.2.3.4",
        PortNumber = 990,
        UserName = "username",
        Password = "password",
        FtpSecure = FtpSecure.Implicit
    };
    using (Session session = new Session())
    {
        session.Open(sessionOptions);
        TransferOptions transferOptions = new TransferOptions();
        transferOptions.TransferMode = TransferMode.Binary;
        TransferOperationResult transferResult;
        transferResult =
            session.GetFiles("/BackupLogs/*", @"C:\InternalShortcuts\BackupLogs\", false, transferOptions);
        transferResult.Check();
        foreach (TransferEventArgs transfer in transferResult.Transfers)
        {
            Console.WriteLine("Download of {0} succeeded", transfer.FileName);
        }
    }
}