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

February 2025
M T W T F S S
 12
3456789
10111213141516
17181920212223
2425262728