C#使用System.Security.Cryptography.Xml签出xml文档

问题描述

是否可以使用System.Security.Cryptography.Xml类的形式对Xml文件进行签名?

SignedXml.ComputeSignature()功能可以通过“手动”实现来实现吗?的东西:

  1. 在签名中创建必要的元素
  2. 使用SHA512.ComputeHash()计算摘要
  3. 使用RSACryptoServiceProvider.SignData()以SignedInfo作为输入来计算SignatureValue

任何有关SignedXml.ComputeSignature()实际操作方式/资源的资源也将受到欢迎。

解决方法

SignedXml.ComputeSignature()功能可以通过“手动”实现来实现吗?

当然可以,但是如果要进行兼容的签名,则必须做所有相同的工作。幸运的是,源代码已发布:https://source.dot.net/#System.Security.Cryptography.Xml/System/Security/Cryptography/Xml/SignedXml.cs,ec07e01153e4b893

任何关于SignedXml.ComputeSignature()实际功能的资源也将受到欢迎。

SignedXml是xmldsig 1.1的实现:https://www.w3.org/TR/xmldsig-core1/