Re: Peer certificate rejected
#$sessionOptions.SshHostKeyFingerprint = "FTP server does not have a finger print"
With FTPS, you need to use
SessionOptions.TlsHostCertificateFingerprint
:
https://winscp.net/eng/docs/library_sessionoptions
#$sessionOptions.SshHostKeyFingerprint = "FTP server does not have a finger print"
SessionOptions.TlsHostCertificateFingerprint
:
. 2014-09-04 11:32:02.895 Connecting to aft.XXX.com:990 ...
. 2014-09-04 11:32:03.015 Connected with aft.XXX.com:990, negotiating TLS connection...
. 2014-09-04 11:32:03.255 Verifying certificate for "WW00057P.XXXXXX.com" with fingerprint XXXX:7b and 18 failures
. 2014-09-04 11:32:33.265 Asking user:
. 2014-09-04 11:32:33.265 **The server's certificate is not known. You have no guarantee that the server is the computer you think it is.**
. 2014-09-04 11:32:33.265
. 2014-09-04 11:32:33.265 Server's certificate details follow:
. 2014-09-04 11:32:33.265
. 2014-09-04 11:32:33.265 Issuer:
. 2014-09-04 11:32:33.265 - Organization: WW00057P.XXXX.com, WW00057P.XXX.com, WW00057P.XXX.com, admin@W
. 2014-09-04 11:32:33.275 - Location: US, US, WW00057P.oneabbott.com
. 2014-09-04 11:32:33.275
. 2014-09-04 11:32:33.275 Subject:
. 2014-09-04 11:32:33.275 - Organization: WW00057P.XXX.com, WW00057P.oneabbott.com, WW00057P.XXX.com, admin@W
. 2014-09-04 11:32:33.275 - Location: US, US, WW00057P.XXXX.com
. 2014-09-04 11:32:33.275
. 2014-09-04 11:32:33.275 Valid: 5/14/2010 6:44:23 PM - 5/14/2011 11:44:19 PM
. 2014-09-04 11:32:33.275
. 2014-09-04 11:32:33.275 Fingerprint (SHA1): XXXXXXXXXXX
. 2014-09-04 11:32:33.275
. 2014-09-04 11:32:33.275 Summary: Self signed certificate. The error occurred at a depth of 1 in the certificate chain.
. 2014-09-04 11:32:33.275
. 2014-09-04 11:32:33.275 Certificate was not issued for this server. You might be connecting to a server that is pretending to be "aft.oneabbott.com".
. 2014-09-04 11:32:33.275
. 2014-09-04 11:32:33.275 If you trust this certificate, press Yes. To connect without storing certificate, press No. To abandon the connection press Cancel.
. 2014-09-04 11:32:33.275
. 2014-09-04 11:32:33.275 Continue connecting and store the certificate? ()
. 2014-09-04 11:32:33.275 Peer certificate rejected
. 2014-09-04 11:32:33.275 Disconnected from server
#Load WinSCP .NET assembly
[Reflection.Assembly]::LoadFrom("C:\Program Files (x86)\WinSCP\WinSCPnet.dll") | Out-Null
$now = Get-Date
write-host "`nwinscp assemly is loaded successfully --- $now `n"
# Setup session options
$sessionOptions = New-Object WinSCP.SessionOptions
$sessionOptions.Protocol = [WinSCP.Protocol]::ftp
#$sessionOptions.FtpMode = [WinSCP.FtpMode]::Passive
$sessionOptions.FtpSecure = [WinSCP.FtpSecure]::Implicit
$sessionOptions.HostName = "aft.XXXXX.com"
$sessionOptions.UserName = "adcbiarvtp"
#$sessionOptions.PortNumber = "21"
$sessionOptions.password = "Spring!14"
#$sessionOptions.SshHostKeyFingerprint = "FTP server does not have a finger print"
$now = Get-Date
write-host "setting up new session --- $now `n"
$session = New-Object WinSCP.Session
$Session.SessionLogPath = “E:\Scripts\Logs\test.txt"
#Connect to the FTP server
$session.Open($sessionOptions)
What version of WinSCP are you using? Make sure you have the latest (stable) one.