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

January 2025
M T W T F S S
 12345
6789101112
13141516171819
20212223242526
2728293031