cancel
Showing results for 
Search instead for 
Did you mean: 

Problem with algorithm signing PDF with adapter module in SAP PI

Former Member
0 Kudos

Hello,

We have developed a java adapter module in order to digitally sign a PDF with SAP PI.

To do this, we have a certificate uploaded in the Key Store.

The problem is, when we run the process and the module is executed, we get this log:

ID21109: Remote call failed

Reading about this error, we know this log is about this exception:

[EXCEPTION]{1}#2#ticket#java.security.NoSuchAlgorithmException: ID21109: Remote call errored at com.sap.engine.services.keystore.spi.EBSDKSKeyStoreSpiImpl.engineGetKey(EBSDKSKeyStoreSpiImpl.java:162 at java.security.KeyStore.getKey(KeyStore.java:320)

In the JAVA code the error comes after the line in blue:

try {

  SAPSecurityResources secRes = SAPSecurityResources.getInstance();

  KeyStoreManager ksm = secRes.getKeyStoreManager(PermissionMode.SYSTEM_LEVEL);

  ks = ksm.getKeyStore(keyStoreView);

  if (ks == null) {

  addError("No se ha encontrado la KeyStore View:" + keyStoreView);

         }

  else{

  addInfo("Se ha encontrado la KeyStore View:" + keyStoreView);

  certificate = ks.getCertificate(alias);

  try {

  privateKey = (PrivateKey) ks.getKey(alias, publicKey);

  addInfo("Private key " + privateKey.toString());

  if(certificate == null){

  addError("No se ha encontrado el certificado:" + alias);

  }

  else{

  addInfo("Se ha encontrado el certificado:" + alias);

  }

  if (privateKey != null){

  addInfo("Se ha encontrado la clave privada");

  addInfo("Algoritmo:" + privateKey.getAlgorithm());

  addInfo("Provider:" + ks.getProvider().getName());

  ExternalSignature pks = new PrivateKeySignature(privateKey, DigestAlgorithms.SHA256, ks.getProvider().getName());

  addInfo("Hash algorithm:" + pks.getHashAlgorithm() );

  }

  } catch (NoSuchAlgorithmException e) {

  /*addError("No se ha encontrado el algoritmo");*/

  addError(e.getLocalizedMessage() + e.getCause().getLocalizedMessage());

  } catch (UnrecoverableKeyException e) {

  addError("Error obteniendo la clave privada");

  }

  }

What could be the problem? Do you know if there is any possibility to install an algorithm in the PI machine?

If we run this adapter module in another SAP PI it works... So, any idea?

Thanks in advance.

Lara.

Accepted Solutions (0)

Answers (1)

Answers (1)

ONavas
Participant
0 Kudos

Hi Lara,

For encryption purpose you need SAPCRYPTO installed in your system.

For download & install check this link:

https://websmp103.sap-ag.de/~sapidb/011000358700000866032001E/sapcrypto.htm#download

I looking for a pdf module to sign PDF like your development. Can you send me code or java project?

If you have solved this issue please share the solution and close this threat.

Former Member
0 Kudos

Hi Oscar,

Thank you for the information about SAPCRYPTO.

Regarding to the PDF sign, you have to develop a Java Adapter Module.

In order to do that, you could implement the sign using iTextPDF java library with the proper SAP security libraries.  You will find theme in your SAP PI server.

Regards.

Lara.