PKCS #7 属性

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

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

可以将属性添加到 authenticatedAttributes未经身份验证的AttributesSignedData 内容类型字段。

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 请求中的 TaggedRequest 结构中。 有关详细信息,请参阅 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 结构 序列中 未经身份验证的Attributes 中。

支持的属性