Your original SFTP client using j2ssh-maverick-1.5.5.jar couldn't connect to Tectia SSH Server due to incompatible cipher algorithms. Tectia requires modern AEAD ciphers like:
aes256-gcm@openssh.comaes128-gcm@openssh.comAEAD_AES_128_GCMAEAD_AES_256_GCM
This enhanced SFTP client supports modern ciphers and provides three implementation options:
File: EnhancedSftpClient.java
- Uses SSHJ library with full AEAD cipher support
- Best compatibility with Tectia SSH Server
- Modern SSH protocol implementation
File: JSchSftpClient.java
- Uses JSch library as alternative
- Good compatibility and lightweight
- Fallback option if SSHJ has issues
File: FtpClientConn.java
- Maintains your original API
- Drop-in replacement for existing code
- Uses enhanced client underneath
Hashtable<String, String> config = new Hashtable<String, String>();
config.put("host", "10.103.3.102"); // Your Tectia server
config.put("port", "22");
config.put("username", "FTPDCOSMY");
// Choose authentication method:
config.put("password", "your_encrypted_password");
// OR
config.put("privatekey", "/path/to/your/private/key");Option A: Minimal Changes (Recommended)
// Replace this line:
// FtpClientConn.setConfigs(config);
// FtpClientConn client = FtpClientConn.getInstance();
// With this:
EnhancedSftpClient.setConfigs(config);
EnhancedSftpClient client = EnhancedSftpClient.getInstance();
// Use SFTP operations:
SFTPClient sftp = client.getSftpClient();
if (sftp != null) {
// Your existing SFTP operations
for (RemoteResourceInfo file : sftp.ls(".")) {
System.out.println("File: " + file.getName());
}
}
// Don't forget to disconnect
EnhancedSftpClient.disconnect();Option B: Use Compatibility Wrapper (No Code Changes)
// Keep your existing code exactly the same!
FtpClientConn.setConfigs(config);
FtpClientConn client = FtpClientConn.getInstance();
// Now uses enhanced client underneath
if (client.isConnected()) {
// Your existing SFTP operations work
SFTPClient sftp = client.getEnhancedSftpClient();
// ... rest of your code
}- Remove:
j2ssh-maverick-1.5.5.jar - Add:
java-sftp-client-1.0.0-jar-with-dependencies.jar
Run the provided test class:
java -cp target/java-sftp-client-1.0.0-jar-with-dependencies.jar my.com.eprotea.ftp.TectiaSftpTestUpdate the test with your actual credentials before running.
✅ Tectia Compatible: Supports all required AEAD ciphers
✅ Modern Security: Latest SSH protocol implementations
✅ Easy Migration: Minimal code changes required
✅ Multiple Options: Choose the best fit for your needs
✅ Better Debugging: Enhanced logging for troubleshooting
✅ Production Ready: Proper error handling and connection management
- Verify server IP, port, and credentials
- Check firewall settings
- Enable debug logging to see cipher negotiation
- Verify your
Encryptor.decrypt()method works correctly - Check private key file path and permissions
- Ensure username is correct
- Check server logs to see which ciphers are being offered
- The client automatically negotiates the best available cipher
- Modern AEAD ciphers will be preferred for Tectia
- Test Connection: Use
TectiaSftpTest.javawith your credentials - Update Code: Choose your preferred implementation approach
- Deploy: Replace the old JAR with the new one
- Monitor: Check logs to confirm AEAD cipher negotiation
Note: Remember to update the Encryptor class with your actual encryption/decryption logic.