I am using edtFTPj/PRO v8.2.2 and am getting this exception:
com.enterprisedt.net.ftp.ssh.SSHFTPKeyException: The host signature is invalid or the host key was not accepted!
at com.enterprisedt.net.ftp.ssh.SCPClient.connectSSH(SCPClient.java:1181)
…
Caused by: com.enterprisedt.net.j2ssh.transport.kex.KeyExchangeException: The host signature is invalid or the host key was not accepted!
at com.enterprisedt.net.j2ssh.transport.TransportProtocolClient.performKeyExchange(TransportProtocolClient.java:461)
…
I have this simple Java test client:
import java.io.IOException;
import com.enterprisedt.net.ftp.FTPException;
import com.enterprisedt.net.ftp.Protocol;
import com.enterprisedt.net.ftp.SecureFileTransferClient;
public class FTPClient {
public static void main(String[] args) throws FTPException, IOException {
SecureFileTransferClient client = new SecureFileTransferClient();
client.setRemoteHost("ftptest.xxx.com");
client.setRemotePort(22);
client.setUserName("user");
client.setPassword("password");
client.setProtocol(Protocol.SFTP);
client.setServerValidationEnabled(true);
client.connect();
client.uploadFile("/tmp/local.txt", "remote.txt");
client.disconnect();
}
}
Debug logging seems to indicate a key exchange problem:
DEBUG [TransportProtocolCommon] 12 Jun 2025 15:04:48.590 : Starting key exchange
DEBUG [TransportProtocolCommon] 12 Jun 2025 15:04:48.590 : Determine Algorithm
DEBUG [TransportProtocolCommon] 12 Jun 2025 15:04:48.591 : Client Algorithms: [ecdh-sha2-nistp256, ecdh-sha2-nistp384, ecdh-sha2-nistp521, diffie-hellman-group1-sha1, diffie-hellman-group14-sha1, diffie-hellman-group14-sha256, diffie-hellman-group16-sha512, diffie-hellman-group18-sha512, diffie-hellman-group-exchange-sha1, diffie-hellman-group-exchange-sha256, ext-info-c]
DEBUG [TransportProtocolCommon] 12 Jun 2025 15:04:48.591 : Server Algorithms: [diffie-hellman-group14-sha1, curve25519-sha256, curve25519-sha256@libssh.org, ecdh-sha2-nistp256, ecdh-sha2-nistp384, ecdh-sha2-nistp521, diffie-hellman-group16-sha512, diffie-hellman-group18-sha512, diffie-hellman-group1-sha1]
DEBUG [TransportProtocolCommon] 12 Jun 2025 15:04:48.591 : Returning ecdh-sha2-nistp256
DEBUG [TransportProtocolCommon] 12 Jun 2025 15:04:48.591 : Key exchange algorithm: ecdh-sha2-nistp256
INFO [ECDHSha2] 12 Jun 2025 15:04:48.591 : Starting client side key exchange.
DEBUG [TransportProtocolCommon] 12 Jun 2025 15:04:48.645 : Sending SSH_MSG_KEX_ECDH_INIT
DEBUG [TransportProtocolCommon] 12 Jun 2025 15:04:48.742 : Received unregistered message: SSH_MSG_KEX_ECDH_REPLY
DEBUG [ECDHSha2] 12 Jun 2025 15:04:48.746 : calculateExchangeHash()
DEBUG [TransportProtocolCommon] 12 Jun 2025 15:04:48.749 : Verifying host ftp.inmoment.com,44.239.215.42
DEBUG [TransportProtocolCommon] 12 Jun 2025 15:04:48.749 : Determine Algorithm
DEBUG [TransportProtocolCommon] 12 Jun 2025 15:04:48.749 : Client Algorithms: [ssh-rsa, rsa-sha2-256, rsa-sha2-512, ecdsa-sha2-nistp256, ecdsa-sha2-nistp384, ecdsa-sha2-nistp521, ssh-ed25519, ssh-dss]
DEBUG [TransportProtocolCommon] 12 Jun 2025 15:04:48.749 : Server Algorithms: [rsa-sha2-512, rsa-sha2-256, ssh-rsa, ssh-rsa]
DEBUG [TransportProtocolCommon] 12 Jun 2025 15:04:48.749 : Returning ssh-rsa
DEBUG [TransportProtocolCommon] 12 Jun 2025 15:04:48.749 : Selected algorithm ssh-rsa
DEBUG [SshRsaPublicKey] 12 Jun 2025 15:04:48.753 : Signature length=404
DEBUG [SshRsaPublicKey] 12 Jun 2025 15:04:48.755 : Verifying signature (com.enterprisedt.cryptix.provider.rsa.SHA1_RSA_PKCS1Signature)
DEBUG [TransportProtocolCommon] 12 Jun 2025 15:04:48.757 : The host signature is invalid
DEBUG [TransportProtocolCommon] 12 Jun 2025 15:04:48.757 : sendDisconnect(9,'The host signature is invalid or the host key was not accepted!')
DEBUG [TransportProtocolCommon] 12 Jun 2025 15:04:48.757 : Sending SSH_MSG_DISCONNECT
DEBUG [TransportProtocolCommon] 12 Jun 2025 15:04:48.757 : stop() called
DEBUG [TransportProtocolCommon] 12 Jun 2025 15:04:48.758 : Disconnect: The host signature is invalid or the host key was not accepted!
DEBUG [State] 12 Jun 2025 15:04:48.758 : Updated state to 5
DEBUG [TransportProtocolCommon] 12 Jun 2025 15:04:48.758 : sendDisconnect(11,'The host signature is invalid or the host key was not accepted!')
Any thoughts?