TrustCore SDK NanoCert API reference  version 7.0
CMSKeyAgreeRecipientId Struct Reference

Union that identifies a CMS recipient. More...

Data Fields

ubyte4 type
 Tells you how to interpret the u member of a CMSKeyAgreeRecipientId structure. More...
 
union {
   CMSIssuerSerialNumber   issuerAndSerialNumber
 
   CMSOriginatorPublicKey   originatorKey
 
   ASN1_ITEMPTR   subjectKeyIdentifier
 
u
 Recipient for which the callback wants a key. More...
 

Detailed Description

This structure is a member in a union in the CMSRecipientId structure.

The CMS_GetPrivateKey() callback function passes pointer to a CMSRecipientId() structure to identify the recipient from which the key is wanted.

The CMSKeyAgreeRecipientId structure is defined as:

    typedef struct CMSKeyAgreeRecipientId
    {
        ubyte4 type;
        union
        {
            CMSIssuerSerialNumber   issuerAndSerialNumber;  // type = NO_TAG
            ASN1_ITEMPTR            subjectKeyIdentifier;   // type = 0 OCTETSTRING
            CMSOriginatorPublicKey  originatorKey;          // type = 1  /
        } u;
    } CMSKeyAgreeRecipientId;

To interpret this structure, read the type value.

  • If type is NO_TAG, the issuerAndSerialNumber applies, which supplies a CMSIssuerSerialNumber structure.
  • If the type is 0 (zero), the subjectKeyIdentifier applies, which provides an ASN1_ITEMPTR structure that provides offset and buffer size information for the subjectKeyIdentifier in the CStream that is passed to the callback.
  • If type is 1 (one), the originatorKey member applies, which provides a CMSOriginatorPublicKey structure.

The CMSKeyAgreeRecipientId structure reflects the layout of the originator component of the KeyAgreeRecipientInfo ASN.1 object:

      KeyAgreeRecipientInfo ::= SEQUENCE {
        version CMSVersion,  -- always set to 3
        originator [0] EXPLICIT OriginatorIdentifierOrKey,
        ukm [1] EXPLICIT UserKeyingMaterial OPTIONAL,
        keyEncryptionAlgorithm KeyEncryptionAlgorithmIdentifier,
        recipientEncryptedKeys RecipientEncryptedKeys }
      OriginatorIdentifierOrKey ::= CHOICE {
        issuerAndSerialNumber IssuerAndSerialNumber,
        subjectKeyIdentifier [0] SubjectKeyIdentifier,
        originatorKey [1] OriginatorPublicKey }
      OriginatorPublicKey ::= SEQUENCE {
        algorithm AlgorithmIdentifier,
        publicKey BIT STRING }

The OriginatorIdentifierOrKey object is a choice of an issuerAndSerialNumber object, a subjectKeyIdentifier object, and an originatorKey object.

Field Documentation

◆ type

ubyte4 CMSKeyAgreeRecipientId::type

Tells you how to interpret the u member of a CMSKeyAgreeRecipientId structure.

◆ u

union { ... } CMSKeyAgreeRecipientId::u

Recipient for which the callback wants a key.


The documentation for this struct was generated from the following file: