0 Replies Latest reply on Feb 26, 2013 9:58 AM by 993377

    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 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 .