Condividi tramite


Attributi PKCS #7

PKCS #7 è uno standard di sintassi del messaggio crittografico. Un messaggio PKCS #7 non costituisce una richiesta di certificato, ma può incapsulare una richiesta PKCS #10 o CMC in una struttura CONTENTInfo ASN.1 usando uno dei tipi di contenuto seguenti. L'incapsulamento consente di aggiungere funzionalità aggiuntive, ad esempio più firme, che non sono altrimenti disponibili.

  • Dati
  • SignedData
  • BustaData
  • SignedAndEnvelopedData
  • DigestiData
  • Encrypteddata

Gli attributi possono essere aggiunti ai campi authenticationdAttributes e unauthenticatedAttributes del tipo di contenuto SignedData .

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
}

Il processo necessario per archiviare la chiave privata di un client in un'autorità di certificazione (CA) fornisce un esempio completo del modo in cui è possibile usare gli attributi autenticati (firmati) e gli attributi non autenticati:

  • Il client crea un oggetto IX509CertificateRequestPkcs10 e aggiunge dati appropriati per il tipo di certificato richiesto.

  • Il client usa la richiesta PKCS #10 per inizializzare un oggetto IX509CertificateRequestCmc . La richiesta PKCS #10 viene inserita nella struttura TaggedRequest nella richiesta CMC. Per altre informazioni, vedere Attributi CMC.

  • Il client crittografa una chiave privata e lo usa per inizializzare un oggetto IX509AttributeArchiveKey . Il nuovo attributo ArchiveKey viene incapsulato in una struttura 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
    } 
    
  • Il client crea un hash SHA-1 della chiave crittografata e lo usa per inizializzare un oggetto IX509AttributeArchiveKeyHash .

  • Il client recupera l'insieme CryptAttributes dalla richiesta CMC e aggiunge gli attributi ArchiveKey e ArchiveKeyHash. Gli attributi vengono inseriti nella struttura TaggedAttributes della richiesta CMC.

  • Il client usa la richiesta CMC per inizializzare un oggetto IX509CertificateRequestPkcs7 . In questo modo la richiesta CMC viene inserita nel campo contentInfo della struttura PKCS #7 SignedData .

  • L'attributo ArchiveKeyHash viene firmato e inserito nella sequenza autenticata diAttributes della struttura SignerInfo .

  • L'attributo ArchiveKey viene inserito nella sequenza unauthenticatedAttributes della struttura SignerInfo associata al segno primario del messaggio PKCS #7.

Attributi supportati