PKCS #7 属性

PKCS #7 是一种加密消息语法标准。 PKCS #7 消息本身并不构成证书请求,但它可以通过使用以下内容类型之一将 PKCS #10 或 CMC 请求封装在 ContentInfo ASN.1 结构中。 通过封装,可以添加其他不可用的额外功能,例如多个签名。

  • 数据
  • SignedData
  • EnvelopedData
  • SignedAndEnvelopedData
  • DigestedData
  • EncryptedData

可以将属性添加到 SignedData 内容类型的 authenticatedAttributesunauthenticatedAttributes 字段。

SignedData ::= SEQUENCE 
{
   version             INTEGER,
   digestAlgorithms    DigestAlgorithmIdentifiers,
   contentInfo         ContentInfo,
   certificates        [0] IMPLICIT Certificates OPTIONAL,
   crls                [1] IMPLICIT CertificateRevocationLists OPTIONAL,
   signerInfos         SignerInfos
}

SignerInfos ::= SET OF SignerInfo

SignerInfo ::= SEQUENCE 
{
    version                     INTEGER,
    sid                         CertIdentifier,
    digestAlgorithm             DigestAlgorithmIdentifier,
    authenticatedAttributes     [0] IMPLICIT Attributes OPTIONAL,
    digestEncryptionAlgorithm   DigestEncryptionAlgId,
    encryptedDigest             EncryptedDigest,
    unauthenticatedAttributes   [1] IMPLICIT Attributes
}

Attributes ::= SET OF Attribute

Attribute ::= SEQUENCE 
{
   type       EncodedObjectID,
   values     AttributeSetValue
}

将客户端私钥存档到证书颁发机构 (CA) 所需的过程提供了一个综合示例,说明如何使用经过身份验证 (签名) 属性和未经身份验证的属性:

  • 客户端创建 IX509CertificateRequestPkcs10 对象,并为所请求的证书类型添加适当的数据。

  • 客户端使用 PKCS #10 请求初始化 IX509CertificateRequestCmc 对象。 PKCS #10 请求放入 CMC 请求中的 TagedRequest 结构中。 有关详细信息,请参阅 CMC 属性

  • 客户端加密私钥,并使用它初始化 IX509AttributeArchiveKey 对象。 新的 ArchiveKey 属性封装在 EnvelopedData 结构中。

    EnvelopedData ::= SEQUENCE 
    {
        version                 INTEGER,
        recipientInfos          RecipientInfos,
        encryptedContentInfo    EncryptedContentInfo
    } 
    
    RecipientInfos ::= SET OF RecipientInfo
    
    EncryptedContentInfo ::= SEQUENCE 
    {
        contentType                 ContentType,
        contentEncryptionAlgorithm  ContentEncryptionAlgId,
        encryptedContent            [0] IMPLICIT EncryptedContent OPTIONAL
    } 
    
    EncryptedContent ::= OCTET STRING
    
    RecipientInfo ::= SEQUENCE 
    {
        version                 INTEGER,
        issuerAndSerialNumber   IssuerAndSerialNumber,
        keyEncryptionAlgorithm  KeyEncryptionAlgId,
        encryptedKey            EncryptedKey
    } 
    
  • 客户端创建加密密钥的 SHA-1 哈希,并使用它初始化 IX509AttributeArchiveKeyHash 对象。

  • 客户端从 CMC 请求检索 CryptAttributes 集合,并向其中添加 ArchiveKeyArchiveKeyHash 属性。 这些属性放置在 CMC 请求 的 TaggedAttributes 结构中。

  • 客户端使用 CMC 请求初始化 IX509CertificateRequestPkcs7 对象。 这会将 CMC 请求放入 PKCS #7 SignedData 结构的 contentInfo 字段中。

  • ArchiveKeyHash 属性已签名,并放置在 SignerInfo 结构的 authenticatedAttributes 序列中。

  • ArchiveKey 属性放置在与 PKCS #7 消息的主要签名者关联的 SignerInfo 结构的 unauthenticatedAttributes 序列中。

支持的属性