Decode signed ZFO file and get XML Content programatically

ZFO files saves data in standart XML format, they can be opened by 602 XML Filler.
But if you want get the content programatically, you need to use SignedCms class (on .net).
Especially, Czech system for Data Messages (ISDS) sends signed ZFO file content from their web services.
To get clean XML content, without signature and other info, use this code:

SignedCms verifyCms = new SignedCms();
verifyCms.Decode(arrZFOBytes);
byte[] xmlZfoContent = verifyCms.ContentInfo.Content;
string cleanXml = Encoding.UTF8.GetString(xmlZfoContent);

Note: SignedCms class is in namespace: System.Security.Cryptography.Pkcs,
so you need to add Reference to System.Security

Marek

Currently working as SharePoint Developer combining both back-end & front-end development scenarios. Also enthusiastic about Office 365 & Azure solutions.

You may also like...

Leave a Reply

Your email address will not be published. Required fields are marked *