Skip to Content
Author's profile photo Paolo Romano

Extracting content from a P7M file

Did you ever tried extracting content from a PKCS7 signed file in ABAP to get

that *&%$ PDF document from it?

 

Well the solution is actually quite easy, and I would like to share it:

 

Download and install the BOUNCYCASTLE libraries from http://www.bouncycastle.org/latest_releases.html, taking care to download the ones which fit your JDK release; create a DC library project and deploy them on your SAP web application server, see this great blog to do that External Library Deployment and Usage in SAP NetWeaver Developer Studiohttp://www.sdn.sap.com/irj/scn/go/portal/prtroot/docs/library/uuid/60d99678-1a29-2d10-94b4-9d9a67b7199b?quicklink=index&overridelayout=true

 

Create a new Java Web Service using NWDS and use this code to decrypt the p7m signed file extracting the signed infos from it:

However, the parameters are base64 encoded, so keep attention to encode/decode your source and result data.

Assigned Tags

      2 Comments
      You must be Logged on to comment or reply to a post.
      Author's profile photo Tomasz Mackowski
      Tomasz Mackowski
      Hi,

      PKCS#7 encryption/decryption can be done directly in ABAP using SSF API ( http://help.sap.com/saphelp_nw2004s/helpdata/en/4d/bf6f77a2c5446a86e0152f1b309db6/content.htm ).
      There is some configuration required in STRUST but it works fine.

      Author's profile photo Marcus Raath
      Marcus Raath
      Hi Tomasz
      I want to use SSF to encrypt outound interface files before writing the data to disk.
      Have you successfully used this?
      Can you provide some details on configuring this?

      Thanks