PKCS #7 屬性

PKCS #7 是密碼編譯訊息語法標準。 PKCS #7 訊息本身不會構成憑證要求,但可以使用下列其中一種內容類型,封裝 ContentInfo ASN.1 結構中的 PKCS #10 或 CMC 要求。 封裝可讓您新增額外的功能,例如多個簽章,否則無法使用。

  • Data
  • 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 要求中的 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集合,並將ArchiveKey 和 ArchiveKeyHash屬性加入其中。 屬性會放在 CMC 要求的 TaggedAttributes 結構中。

  • 用戶端會使用 CMC 要求來初始化 IX509CertificateRequestPkcs7 物件。 這會將 CMC 要求放入 PKCS #7 SignedData結構的contentInfo欄位中。

  • ArchiveKeyHash屬性會簽署並放置在SignerInfo結構的authenticatedAttributes序列中。

  • ArchiveKey屬性會放在與 PKCS #7 訊息主要簽署者相關聯之 SignerInfo結構的未驗證Attributes序列中。

支援的屬性