Forum Stats

  • 3,816,058 Users
  • 2,259,135 Discussions


Issues accessing keystore of SAP Portal

we need to configure an SSO from SAP portal and a third party website by passing encrypted userid as url parameters.
To configure the SSO I have received the public key of the third party and able to access it from server location. Now I have to access priavte key of the SAP Portal certificate and sign the UserId and pass it as url parameter. I have gone through many blogs and written code as below which is giving Invalid Keystore Format error.

My question is
1. What should be passed to FileInputStream?
As of now we are passing the .cer file which is stored as part of project.

Below code is throwing error at ks.load() method.

String fielPath1 = request.getPublicResourcePath()+"/SAPLogonTicketKeypair-cert1.cer";
FileInputStream ksfis = new FileInputStream(fielPath1);
KeyStore ks = KeyStore.getInstance("JKS");
ks.load(null, sPass.toCharArray());
BufferedInputStream ksbufin = new BufferedInputStream(ksfis);
ks.load(ksbufin, sPass.toCharArray());
PrivateKey priv = (PrivateKey) ks.getKey(alias, kPass.toCharArray());

Error is:

Invalid keystore$JKS.engineLoad(

Please let me know how to pass the filepath to extract the priavte key .

This discussion has been closed.