Elena kretova

Same encryption Java code outputs undecryptable content in SAP PI but decryptable in Eclipse

Discussion created by Elena kretova on Dec 26, 2017


I am using Bouncy Castle java to encrypt files using PGP. The program is meant to run into SAP PI 7.0. When I run PI’s output (encrypted file) against the decryption program, I get an empty decrypted file with no error.

So, I tried to encrypt the same source file in Eclipse, using the same parameters. This time, I was able to decrypt the output correctly to retrieve my original file. Same code, same input.

At some point, I noticed that SAP PI Training output is a few bytes shorter (usually 32 bytes) than Eclipse’s output. I think that’s the reason why the decryption output is empty without error. I have no idea what might be missing in the encrypted file as both PGP message have the same shape.

Any suggestion on how I can fix it? Is there a part of the PGP message that is missing? Do I miss a library or a configuration point in PI environment?

Technical details

Bouncy Castle

Local environment

  • Java: 1.6.0_45
  • Operating System: Windows 7 SP1
  • JDK version: 1.3

SAP PI environment

  • PI version: 7.0
  • Java Runtime: Java(TM) 2 Runtime Environment, Standard Edition (version=1.4.2_14-b05)
  • Java Virtual Machine : Java HotSpot(TM) 64-Bit Server VM (version=1.4.2_14-b05)
  • Operation System: Windows 2003 (version=5.2, arch=amd64)
  • JDK version: 1.3