2019 Aug 07 3:32 PM - edited 2024 Feb 03 5:12 PM
We are using the below spring configuration to download csv file to local folder and this is working fine. Is it also possible to upload a file using similar spring configuration using a .ppk file for authentication?
<bean id="rtsftpSessionFactory" class="org.springframework.integration.sftp.session.DefaultSftpSessionFactory">
<property name="host" value="${rtHost}"/>
<property name="password" value="${rtPassword}"/>
<property name="port" value="${rtPort}"/>
<property name="user" value="${rtUser}"/>
<property name="allowUnknownKeys" value="true"/>
</bean>
<int:channel id="sftpChannel"/>
<!-- Copy remote file to local directory -->
<sftp:inbound-channel-adapter id="rtsftpAdapterAutoCreate" session-factory="rtsftpSessionFactory" channel="sftpChannel" filename-regex="^(content.*).csv"
remote-directory="${rtRemoteFolder}" local-directory="#{baseDirectory}" auto-create-local-directory="true" auto-startup="${sftp.on}"
delete-remote-files="true">
<int:poller cron="0 0 * * * *"/>
</sftp:inbound-channel-adapter>
Request clarification before answering.
Hi Ansari,
You would first need to convert the ppk file to openSSH key first and then pass the privateKey along with the privateKeyPassPhrase to the rtsftpSessionFactory bean. like below:
<bean id="rtsftpSessionFactory" class="org.springframework.integration.sftp.session.DefaultSftpSessionFactory">
<property name="host" value="${rtHost}"/>
<property name="port" value="${rtPort}"/>
<property name="privateKeyPassphrase" value="${passphrase}"/>
<property name="privateKey" value="${path to private key}"/>
</bean>
Here is the link which can be used for the conversion.
.ppk file to openssh key conversion
I hope this helps you.
thanks,
Himanshu Mehta
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
8 | |
1 | |
1 | |
1 | |
1 | |
1 | |
1 | |
1 | |
1 | |
1 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.