嗨,尝试在我的sftp应用程序中设置mac和密钥交换。应用程序正在使用jscape。我看到有一个方法来设置这些,但不确定我需要传递给他们什么。sshconfiguration.gettransportconfiguration().getalgorithmfactory().addkeyexchange(java.lang.string sshname,java.lang.class kexclass)sshconfiguration.gettransportconfiguration().getalgorithmfactory().addmac(java.lang.string sshname,java.lang.string jcename,int keylength)
我需要用其中一个。我试图研究,但找不到多少信息如何做到这一点。谢谢。
Sftp sftp = null;
try {
//OutLog.getInstance().printInformation("sftp!!!");
errMsg = "";
File privateKey = new File(keyFile);
// create SshParameters instance using public key authentication
SshParameters params = new SshParameters(ftpHostname, ftpUsername, privateKey);
//new - DXC retired the 3des algorithm and wanted us to use AES instead
//first set the preferred cipher onto the ssh config
SshConfiguration sshConfiguration = new SshConfiguration();
sshConfiguration.setTransportConfiguration(new TransportConfiguration());
sshConfiguration.getTransportConfiguration().getAlgorithmFactory().addKeyExchange(arg0, arg1)
sshConfiguration.getTransportConfiguration().getAlgorithmFactory().addMac(arg0, arg1, arg2)
sshConfiguration.getTransportConfiguration().getAlgorithmFactory().addCipher("aes128-cbc", "AES/CBC/NoPadding", 16);
暂无答案!
目前还没有任何答案,快来回答吧!