小编lkn*_*993的帖子

使用XML直接签署Office Word文档

我正在尝试使用直接XML格式的C#签署Microsoft Office Word文件.

有一些问题,这里出现了模棱两可的问题:

  • 我应该如何填写摘要值,我应该为每个参考准确消化什么值,以及我应该为每个转换消化什么值?
  • 我应该签署什么价值来创建SignatureValue
  • 我应该在x509数据中包含哪些证书以及如何?(我们没有确切的证书,所以我们非常感谢您创建一个证书.)

最后一个问题是我正确地这样做了吗?也许这里有问题,我错过了一个软件包,否则它本身会与openxml文件交互并签名.

但请记住,我实际上是尝试使用外部令牌签署数据,该外部令牌具有可用的pkcs11接口(但没有CSP),所以我使用了PKCS11 Interop库将其迁移到c#,但我在这里仍然有点困惑.

  • 有没有我可以用来签署word文档的包?
  • 或者是否有一个简化openXML交互的包?
  • 或者我必须手动完成吗?

只是为了抬头任何执行openXML交互的库也应该允许我使用pkcs11命令对文档进行签名(即,它给我字节流来签名和消化但是其他部分本身,pkcs11实际上不应该被认为是一个重要性在这里(你可以用我的自定义算法替换它))

BTW中的签名构建器如下所示:

<?xml version="1.0" encoding="UTF-8"?>
<Signature xmlns="http://www.w3.org/2000/09/xmldsig#" Id="idPackageSignature">
  <SignedInfo>
    <CanonicalizationMethod Algorithm="http://www.w3.org/TR/2001/REC-xml-c14n-20010315"/>
    <SignatureMethod Algorithm="http://www.w3.org/2001/04/xmldsig-more#rsa-sha256"/>
    <Reference Type="http://www.w3.org/2000/09/xmldsig#Object" URI="#idPackageObject">
      <DigestMethod Algorithm="http://www.w3.org/2001/04/xmlenc#sha256"/>
      <DigestValue/>
    </Reference>
    <Reference Type="http://www.w3.org/2000/09/xmldsig#Object" URI="#idOfficeObject">
      <DigestMethod Algorithm="http://www.w3.org/2001/04/xmlenc#sha256"/>
      <DigestValue/>
    </Reference>
    <Reference Type="http://uri.etsi.org/01903#SignedProperties" URI="#idSignedProperties">
      <Transforms>
        <Transform Algorithm="http://www.w3.org/TR/2001/REC-xml-c14n-20010315"/>
      </Transforms>
      <DigestMethod Algorithm="http://www.w3.org/2001/04/xmlenc#sha256"/>
      <DigestValue/>
    </Reference>
  </SignedInfo>
  <SignatureValue/>
  <KeyInfo>
    <X509Data>
      <X509Certificate/>
    </X509Data>
  </KeyInfo>
  <Object Id="idPackageObject">
    <Manifest>
      <Reference URI="/_rels/.rels?ContentType=application/vnd.openxmlformats-package.relationships+xml">
        <Transforms>
          <Transform Algorithm="http://schemas.openxmlformats.org/package/2006/RelationshipTransform">
            <mdssi:RelationshipReference xmlns:mdssi="http://schemas.openxmlformats.org/package/2006/digital-signature" SourceId="rId1"/>
          </Transform>
          <Transform Algorithm="http://www.w3.org/TR/2001/REC-xml-c14n-20010315"/>
        </Transforms>
        <DigestMethod Algorithm="http://www.w3.org/2001/04/xmlenc#sha256"/>
        <DigestValue/>
      </Reference>
      <Reference …
Run Code Online (Sandbox Code Playgroud)

c# xml ms-office openxml

9
推荐指数
1
解决办法
1090
查看次数

Docx或XPS(或一般的ooxml)关系转换示例

好吧,我已经知道有一个关于此的文件,其中说明:

12.2.4.26 Relationships Transform Algorithm
13 The relationships transform takes the XML document from the Relationships part and converts it to another
14 XML document.
15 The package implementer might create relationships XML that contains content from several namespaces, along
16 with versioning instructions as defined in Part 5: “Markup Compatibility and Extensibility”. [O6.11]
17 The relationships transform algorithm is as follows:
18 Step 1: Process versioning instructions
19 1. The package implementer shall process the versioning instructions, considering that …
Run Code Online (Sandbox Code Playgroud)

xml docx xps openxml

9
推荐指数
1
解决办法
242
查看次数

使用apache spark迭代字符串

例如,我们有字符串"abcdabcd"

我们想要计算字符串中可用的所有对(例如:"ab"或"da").

那么我们如何在apache spark中做到这一点呢?

我问这个原因看起来RDD不支持滑动功能:

rdd.sliding(2).toList
//Count number of pairs in list
//Returns syntax error on first line (sliding)
Run Code Online (Sandbox Code Playgroud)

scala apache-spark

1
推荐指数
1
解决办法
418
查看次数

标签 统计

openxml ×2

xml ×2

apache-spark ×1

c# ×1

docx ×1

ms-office ×1

scala ×1

xps ×1