Spring integration 使用privateKey字符串的DefaultSftpSessionFactory
我正在寻找一种使用私钥字符串创建DefaultSftpSessionFactory的方法。本文档中可用的不同功能是使用私钥资源(本地文件) 创建SftpRemoteFileTemplate所需的SessionFactory有什么想法吗?我将用户、主机和私钥作为字符串Spring integration 使用privateKey字符串的DefaultSftpSessionFactory,spring-integration,spring-integration-sftp,Spring Integration,Spring Integration Sftp,我正在寻找一种使用私钥字符串创建DefaultSftpSessionFactory的方法。本文档中可用的不同功能是使用私钥资源(本地文件) 创建SftpRemoteFileTemplate所需的SessionFactory有什么想法吗?我将用户、主机和私钥作为字符串 -谢谢设定者需要一个资源 /** * Allows you to set a {@link Resource}, which represents the location of the * private key used f
-谢谢设定者需要一个
资源
/**
* Allows you to set a {@link Resource}, which represents the location of the
* private key used for authenticating against the remote host. If the privateKey
* is not provided, then the {@link DefaultSftpSessionFactory#setPassword(String) password}
* property is mandatory (or {@link #setUserInfo(UserInfo) userInfo} that returns a
* password.
* @param privateKey The private key.
* @see JSch#addIdentity(String)
* @see JSch#addIdentity(String, String)
*/
public void setPrivateKey(Resource privateKey) {
this.privateKey = privateKey;
}
有多种资源
,包括ByteArrayResource
,您可以在其中使用
setPrivateKey(new ByteArrayResource(myKeyString.getBytes());