由 CA 签署的 X509 数字证书包含这两个字段以及其他字段。
1.签名算法
2. 签名值
我了解“签名算法”字段包含 CA 用于签署证书的哈希算法。 “签名值”是在哈希上计算的签名。
我的问题是散列的数据是什么?公钥是 CSR(证书签名请求)的一部分还是整个 CSR?
最佳答案
形成签名输入的既不是公钥本身,也不是用于请求证书的 CSR。
根据 RFC 5280 - Internet X.509 Public Key Infrastructure Certificate and Certificate Revocation List (CRL) Profile :
The signatureValue field contains a digital signature computed upon the ASN.1 DER encoded tbsCertificate. The ASN.1 DER encoded tbsCertificate is used as the input to the signature function.
syntax of
tbsCertificate
(tbs = 待签名) 是:TBSCertificate ::= SEQUENCE {
version [0] EXPLICIT Version DEFAULT v1,
serialNumber CertificateSerialNumber,
signature AlgorithmIdentifier,
issuer Name,
validity Validity,
subject Name,
subjectPublicKeyInfo SubjectPublicKeyInfo,
issuerUniqueID [1] IMPLICIT UniqueIdentifier OPTIONAL,
-- If present, version MUST be v2 or v3
subjectUniqueID [2] IMPLICIT UniqueIdentifier OPTIONAL,
-- If present, version MUST be v2 or v3
extensions [3] EXPLICIT Extensions OPTIONAL
-- If present, version MUST be v3
}
此结构的 DER 编码是计算签名的数据。
关于digital-signature - 解释 X509 数字证书的证书签名值字段,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/29786863/