How to extract xml file from .p7m file extension (e.g. FATTURA ELETTRONICA, ITALY) RRS feed

  • Question

  • Hi,

    We have a requirement to read the xml contents within .p7m file. Currently we are using .Net technology in our source code. I have the following questions:

    1. How to extract the xml content from this file?

    2. Can we achieve using Microsoft API? If yes, please provide sample code. 

    3. Do we need third party APIs? If yes, which are all the providers and which one is best and cost effective?

    Please help us.

    With Regards,

    Suresh Kaushik

    Tuesday, October 22, 2019 9:09 AM

All replies

  • Hi Suresh,

    Thank you for posting here.

    Based on my search, I could not find Microsoft API to extract xml file from .p7m file.

    First, you could install nuget package->chilkat-x64.

    Second, you could try the following code.

      Chilkat.Crypt2 crypt = new Chilkat.Crypt2();
                string outputFile = "original.xml";
                string inFile = "test.p7m";
                // Verify the signature and extract the XML file.
                bool success = crypt.VerifyP7M(inFile, outputFile);

    Best Regards,


    MSDN Community Support
    Please remember to click "Mark as Answer" the responses that resolved your issue, and to click "Unmark as Answer" if not. This can be beneficial to other community members reading this thread. If you have any compliments or complaints to MSDN Support, feel free to contact

    Wednesday, October 23, 2019 8:21 AM