【发布时间】:2020-03-01 17:33:49
【问题描述】:
我想为我的 SFTP 连接添加 TLS 支持。目前使用JSch来实现。 但我不确定如何使用它。
private void connection() {
JSch jsch = new JSch();
try {
session = jsch.getSession(username, host, port);
session.setPassword(password);
session.setConfig(MAX_SESSIONS_PROP, MAX_SESSIONS_DEFAULT);
session.setConfig(MAX_STARTUPS_PROP, MAX_STARTUPS_DEFAULT);
session.setTimeout(DEFAULT_TIMEOUT_MS);
session.connect();
channel = session.openChannel(CHANNEL);
channel.connect();
channelSftp = (ChannelSftp) channel;
} catch (JSchException e) {
throw new ConnectException("Can not get connection to SFTP: ", e);
}
}
请帮帮我。
【问题讨论】:
-
为什么?它已经很安全了。