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


Leave a Reply

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

About me

I am web developer, tech enthusiast and fitness junkie 🙂

Calendar

October 2024
M T W T F S S
 123456
78910111213
14151617181920
21222324252627
28293031