I am trying to use implicit FTPS with server validation. Sometimes it is working and sometimes I am getting the error "Server certificate could not be validated". Can someone please help? Thanks
Here is my java code.
// at one point, I got error "certificate chain is too long, so I added the line below
SSLFTPStandardValidator.MAX_CERTIFICATE_CHAIN_LENGTH = 5;
// create client
ftp = new SSLFTPClient();
// disable standard SSL closure
ftp.setConfigFlags(SSLFTPClient.ConfigFlags.DISABLE_SSL_CLOSURE);
// set remote host
ftp.setRemoteHost(host);
// load root certificates
ftp.getRootCertificateStore().importPEMFile(serverCertFilename);
ftp.setCustomValidator(new SSLFTPStandardValidator(false));
// set implicit mode
ftp.setImplicitFTPS(true);
Here is the error mesage:
ERROR [SSLSocket] 9 Jun 2011 13:43:16.082 : internalSocket() failed - closing socket : Server certificate coul
d not be validated.
com.enterprisedt.net.puretls.cert.CertificateVerifyException: Server certificate could not be validated.