如何从ZFO中提取附件? [英] How to extract attachments from a ZFO?

查看:121
本文介绍了如何从ZFO中提取附件?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

是否有人知道如何从.zfo文件(602填充表格)中提取附件.它是一种基于openXML的格式.

Does anyone know how to extract the attachments from a .zfo file (602 form filler). Its a format based on openXML.

谢谢

推荐答案

以我的经验,.zfo消息只是经过签名的XML文件(CMS/PKCS#7标准).您需要做的只是删除加密的信封,这将为您提供一个易于阅读的XML文件.对于捷克ISDS,所有附件都列在<p:dmFiles>元素中.

In my experience .zfo messages are just signed XML files (CMS/PKCS #7 standard). All you need to do is to remove the encrypted envelope, which gives you a XML file that you can easily read. In case of Czech ISDS all attachments are listed in a <p:dmFiles> element.

XML示例:

...
<p:dmFiles xmlns:p="http://isds.czechpoint.cz/v20">
  <p:dmFile dmMimeType="doc" ... >
    <p:dmEncodedContent> ... </p:dmEncodedContent>
  </p:dmFile>
  <p:dmFile dmMimeType="pdf" ...>
    <p:dmEncodedContent> ... </p:dmEncodedContent>
  </p:dmFile>
</p:dmFiles>

您可以使用C#来访问内容元素,如下所示:

You can reach the content elements using C# like this:

var message = new  System.Security.Cryptography.Pkcs.SignedCms();
message.Decode(System.IO.File.ReadAllBytes("message.zfo"));

var doc = new System.Xml.XmlDocument();
using (var ms = new System.IO.MemoryStream(message.ContentInfo.Content))
{
    doc.Load(ms);
    var list = d.DocumentElement.GetElementsByTagName("p:dmEncodedContent");
}

这篇关于如何从ZFO中提取附件?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆