In this example, first module is to convert payload from XML to CSV format using MessageTransformBean. Then PGPEncryption module used to apply signature and encryption to CSV message, and finally send out to target using SFTP adapter or any other adapter.
Based on PO PGP module guide and example, All PGP key (partner public key and own private and public key) need to place at PO file system, default path usr/sap/<System ID>/<Instance ID>/sec.
It will be a huge effort to create new PGP public and private key, then send and ask all trading partners change to newly created PGP public key, effort of testing and go live for each partners is huge. In current project, found a way to reuse existing partner public PGP key and own PGP public and private key at above path. Eliminate the need to ask partner change PGP key. This is especially benefit if existing own key still have many years before it expiry.
Initial testing faced below errors:
Signing error, and found solution here https://scn.sap.com/thread/3320339
Encryption error, and found solution here https://scn.sap.com/thread/3225517
Based on note 1915999 (Verify JCE Unlimited Strength Jurisdiction Policy), checked PO is support till default 128 bit keysize only, but PGP key is at lest 1024 bits up to 4096 bit, so not supported.
The solution is need to apply these step to jce to unlimited strength up to 4096 bits:
If you are using SAP PO 7.5 with Java 8, then you need to download corresponding Java 8 JCE from Oracle java website.
Test PGP module again, now no longer have above error, all is success.