【问题标题】:CAdES signature with win32 low level message apis带有 win32 低级消息 API 的 CAdES 签名
【发布时间】:2019-01-18 21:34:39
【问题描述】:

我正在尝试使用低级消息函数来创建符合 CAdES-BES 的签名。

签名必须采用正确的 PKCS#7 格式,并带有四个签名属性。

前两个,type和hash是自动放的,但是crypto library。

第三个是消息的时间。我能够使用 CryptEncodeObject 和 szOID_RSA_signingTime “1.2.840.113549.1.9.5”。

第四个是签名证书,加密 API 1.2.840.113549.1.9.16.2.47 不支持 OID。

为了能够手动添加,我必须知道 CryptEncodeObject 在内部是如何工作的,以及要编码的结构类型:

SigningCertificateV2 ::=  SEQUENCE {
certs        SEQUENCE OF ESSCertIDv2,
policies     SEQUENCE OF PolicyInformation OPTIONAL
}


ESSCertIDv2 ::=  SEQUENCE {
hashAlgorithm           AlgorithmIdentifier
       DEFAULT {algorithm id-sha256},
certHash                 Hash,
issuerSerial             IssuerSerial OPTIONAL
}

Hash ::= OCTET STRING

IssuerSerial ::= SEQUENCE {
 issuer                   GeneralNames,
 serialNumber             CertificateSerialNumber
}

以及在完成之前必须包含的更多结构。

可以尝试使用 ASN.1 编译器来构建整个东西,然后使用 DER 编码器对其进行编码,但有没有更简单的方法?

【问题讨论】:

    标签: c++ cryptography asn.1


    【解决方案1】:

    我做到了,您必须使用 ASN.1 编译器,然后使用 CMS 对签名属性进行编码。

    https://www.codeproject.com/Articles/1256991/AdES-An-implementation-of-CAdES-for-Windows-in-Cpl

    【讨论】:

      猜你喜欢
      • 2015-01-09
      • 1970-01-01
      • 1970-01-01
      • 2012-08-03
      • 2021-06-16
      • 1970-01-01
      • 2011-04-18
      • 1970-01-01
      • 2018-07-05
      相关资源
      最近更新 更多