cancel
Showing results for 
Search instead for 
Did you mean: 

SFTP key based Authentication for Custom Module

former_member207622
Contributor
0 Kudos

Hi Folks ,

I am using  Key based authentication in my receiver SFTP adapter.

I also have a custom module which will place file on SFTP  server and at the same time Ack file on NFS system.

Can anyone let me know how to access the key store for certificate and private key in the custom module as ( certificate and private key is located in NWA )

I would require that in module for authentication purpose.

Any help is appreciated

Thanks

Ninad Sane

Accepted Solutions (0)

Answers (2)

Answers (2)

former_member207622
Contributor
0 Kudos

Hi Team/Praveen

I am able to access the private key through the code given above from the keystore.

Now I want to use this private key in this method -

jsch.addIdentity
But for this parameters should be private key path .
Can you please let me know how to proceed ahead for authentication. I have already supplied the customer the public key .
Thanks
Ninad Sane

former_member207622
Contributor
0 Kudos

Hi team any update on this?

former_member207622
Contributor
0 Kudos

Solved MY self

Former Member
0 Kudos

How was it solved? How did you convert the java.security.PrivateKey to the format Jsch wants to have?

former_member182412
Active Contributor
0 Kudos

Hi Ninad,

You can find the help document here Accessing the AS Java Keystore - SAP NetWeaver Process Integration - SAP Library

Sample adapter have the example code for this.


SAPSecurityResources secRes = SAPSecurityResources.getInstance();

  KeyStoreManager ksMgr = secRes.getKeyStoreManager(PermissionMode.SYSTEM_LEVEL, new String[]{ "sap.com/com.sap.aii.adapter.sample.ra" } );

  java.security.KeyStore ks = ksMgr.getKeyStore(privKeyView);

  ISsfProfile privKeyProf = ksMgr.getISsfProfile(ks, privKeyAlias, null); //Since code based permission is used no password needs to be supplied

  java.security.PrivateKey privKey = privKeyProf.getPrivateKey();

check this thread also Keystore access in Java Mapping Program - user ... | SCN

Regards,

Praveen.

former_member207622
Contributor
0 Kudos

Hi Praveen,

Thanks for the Info!

Can you please explain the variables/ place holders used in the code

also what all parameters we  need to pass through module parameters

Thanks

Ninad Sane