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

December 2024
M T W T F S S
 1
2345678
9101112131415
16171819202122
23242526272829
3031