This discussion is archived
0 Replies Latest reply: Feb 26, 2013 3:19 AM by 993377 RSS

Invalid Keystore Format error

993377 Newbie
Currently Being Moderated
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 formatsun.security.provider.JavaKeyStore.engineLoad(JavaKeyStore.java:633)sun.security.provider.JavaKeyStore$JKS.engineLoad(JavaKeyStore.java:38)java.security.KeyStore.load(KeyStore.java:1185)am_sso_apc.doContent(am_sso_apc.java:132)com.sapportals.portal.prt.component.AbstractPortalComponent.serviceDeprecated(AbstractPortalComponent.java:213)



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

Regards,
Satish

Legend

  • Correct Answers - 10 points
  • Helpful Answers - 5 points