#ifndef _CMSTPRIV_H_
#define _CMSTPRIV_H_
#include <Security/SecCmsBase.h>
#include <security_smime/secoidt.h>
#include <Security/secasn1t.h>
#include <security_asn1/plarenas.h>
#include <Security/nameTemplates.h>
#include <CoreFoundation/CFArray.h>
#include <CoreFoundation/CFDate.h>
#include <Security/SecCertificate.h>
#include <Security/SecKey.h>
typedef struct SecCmsContentInfoStr SecCmsContentInfo;
typedef struct SecCmsMessageStr SecCmsMessage;
typedef struct SecCmsSignedDataStr SecCmsSignedData;
typedef struct SecCmsSignerInfoStr SecCmsSignerInfo;
typedef struct SecCmsEnvelopedDataStr SecCmsEnvelopedData;
typedef struct SecCmsRecipientInfoStr SecCmsRecipientInfo;
typedef struct SecCmsDigestedDataStr SecCmsDigestedData;
typedef struct SecCmsEncryptedDataStr SecCmsEncryptedData;
typedef struct SecCmsIssuerAndSNStr SecCmsIssuerAndSN;
typedef struct SecCmsOriginatorInfoStr SecCmsOriginatorInfo;
typedef struct SecCmsAttributeStr SecCmsAttribute;
typedef union SecCmsContentUnion SecCmsContent;
typedef struct SecCmsSignerIdentifierStr SecCmsSignerIdentifier;
typedef struct SecCmsSMIMEKEAParametersStr SecCmsSMIMEKEAParameters;
typedef struct SecCmsCipherContextStr SecCmsCipherContext;
typedef struct SecCmsCipherContextStr *SecCmsCipherContextRef;
union SecCmsContentUnion {
SecAsn1Item * data;
SecCmsDigestedDataRef digestedData;
SecCmsEncryptedDataRef encryptedData;
SecCmsEnvelopedDataRef envelopedData;
SecCmsSignedDataRef signedData;
void * pointer;
};
struct SecCmsContentInfoStr {
SecAsn1Item contentType;
SecCmsContent content;
SecCmsMessageRef cmsg;
SECOidData * contentTypeTag;
SECAlgorithmID contentEncAlg;
SecAsn1Item * rawContent;
SecSymmetricKeyRef bulkkey;
int keysize;
SECOidTag contentEncAlgTag;
SecCmsCipherContextRef ciphcx;
SecCmsDigestContextRef digcx;
SecPrivateKeyRef privkey;
};
struct SecCmsMessageStr {
SecCmsContentInfo contentInfo;
PLArenaPool * poolp;
int refCount;
void * pwfn_arg;
SecCmsGetDecryptKeyCallback decrypt_key_cb;
void * decrypt_key_cb_arg;
};
struct SecCmsSignedDataStr {
SecCmsContentInfo contentInfo;
SecAsn1Item version;
SECAlgorithmID ** digestAlgorithms;
SecAsn1Item ** rawCerts;
SecAsn1Item ** rawCrls;
SecCmsSignerInfoRef * signerInfos;
SecAsn1Item ** digests;
CFMutableArrayRef certs;
};
#define SEC_CMS_SIGNED_DATA_VERSION_BASIC 1
#define SEC_CMS_SIGNED_DATA_VERSION_EXT 3
typedef enum {
SecCmsSignerIDIssuerSN = 0,
SecCmsSignerIDSubjectKeyID = 1
} SecCmsSignerIDSelector;
struct SecCmsSignerIdentifierStr {
SecCmsSignerIDSelector identifierType;
union {
SecCmsIssuerAndSN *issuerAndSN;
SecAsn1Item * subjectKeyID;
} id;
};
struct SecCmsIssuerAndSNStr {
NSS_Name issuer;
SecAsn1Item serialNumber;
SecAsn1Item derIssuer;
};
struct SecCmsSignerInfoStr {
SecAsn1Item version;
SecCmsSignerIdentifier signerIdentifier;
SECAlgorithmID digestAlg;
SecCmsAttribute ** authAttr;
SECAlgorithmID digestEncAlg;
SecAsn1Item encDigest;
SecCmsAttribute ** unAuthAttr;
SecCmsSignedDataRef signedData;
SecCertificateRef cert;
CFArrayRef certList;
CFAbsoluteTime signingTime;
SecCmsVerificationStatus verificationStatus;
SecPrivateKeyRef signingKey;
SecPublicKeyRef pubKey;
CFDataRef hashAgilityAttrValue;
CFDictionaryRef hashAgilityV2AttrValues;
CFAbsoluteTime expirationTime;
};
#define SEC_CMS_SIGNER_INFO_VERSION_ISSUERSN 1
#define SEC_CMS_SIGNER_INFO_VERSION_SUBJKEY 3
struct SecCmsEnvelopedDataStr {
SecCmsContentInfo contentInfo;
SecAsn1Item version;
SecCmsOriginatorInfo * originatorInfo;
SecCmsRecipientInfoRef * recipientInfos;
SecCmsAttribute ** unprotectedAttr;
};
#define SEC_CMS_ENVELOPED_DATA_VERSION_REG 0
#define SEC_CMS_ENVELOPED_DATA_VERSION_ADV 2
struct SecCmsOriginatorInfoStr {
SecAsn1Item ** rawCerts;
SecAsn1Item ** rawCrls;
SecCertificateRef * certs;
};
typedef enum {
SecCmsRecipientIDIssuerSN = 0,
SecCmsRecipientIDSubjectKeyID = 1
} SecCmsRecipientIDSelector;
struct SecCmsRecipientIdentifierStr {
SecCmsRecipientIDSelector identifierType;
union {
SecCmsIssuerAndSN *issuerAndSN;
SecAsn1Item * subjectKeyID;
} id;
};
typedef struct SecCmsRecipientIdentifierStr SecCmsRecipientIdentifier;
struct SecCmsKeyTransRecipientInfoStr {
SecAsn1Item version;
SecCmsRecipientIdentifier recipientIdentifier;
SECAlgorithmID keyEncAlg;
SecAsn1Item encKey;
};
typedef struct SecCmsKeyTransRecipientInfoStr SecCmsKeyTransRecipientInfo;
struct SecCmsKeyTransRecipientInfoExStr {
SecCmsKeyTransRecipientInfo recipientInfo;
int version;
SecPublicKeyRef pubKey;
};
typedef struct SecCmsKeyTransRecipientInfoExStr SecCmsKeyTransRecipientInfoEx;
#define SEC_CMS_KEYTRANS_RECIPIENT_INFO_VERSION_ISSUERSN 0
#define SEC_CMS_KEYTRANS_RECIPIENT_INFO_VERSION_SUBJKEY 2
struct SecCmsOriginatorPublicKeyStr {
SECAlgorithmID algorithmIdentifier;
SecAsn1Item publicKey;
};
typedef struct SecCmsOriginatorPublicKeyStr SecCmsOriginatorPublicKey;
typedef enum {
SecCmsOriginatorIDOrKeyIssuerSN = 0,
SecCmsOriginatorIDOrKeySubjectKeyID = 1,
SecCmsOriginatorIDOrKeyOriginatorPublicKey = 2
} SecCmsOriginatorIDOrKeySelector;
struct SecCmsOriginatorIdentifierOrKeyStr {
SecCmsOriginatorIDOrKeySelector identifierType;
union {
SecCmsIssuerAndSN *issuerAndSN;
SecAsn1Item * subjectKeyID;
SecCmsOriginatorPublicKey originatorPublicKey;
} id;
};
typedef struct SecCmsOriginatorIdentifierOrKeyStr SecCmsOriginatorIdentifierOrKey;
struct SecCmsRecipientKeyIdentifierStr {
SecAsn1Item * subjectKeyIdentifier;
SecAsn1Item * date;
SecAsn1Item * other;
};
typedef struct SecCmsRecipientKeyIdentifierStr SecCmsRecipientKeyIdentifier;
typedef enum {
SecCmsKeyAgreeRecipientIDIssuerSN = 0,
SecCmsKeyAgreeRecipientIDRKeyID = 1
} SecCmsKeyAgreeRecipientIDSelector;
struct SecCmsKeyAgreeRecipientIdentifierStr {
SecCmsKeyAgreeRecipientIDSelector identifierType;
union {
SecCmsIssuerAndSN *issuerAndSN;
SecCmsRecipientKeyIdentifier recipientKeyIdentifier;
} id;
};
typedef struct SecCmsKeyAgreeRecipientIdentifierStr SecCmsKeyAgreeRecipientIdentifier;
struct SecCmsRecipientEncryptedKeyStr {
SecCmsKeyAgreeRecipientIdentifier recipientIdentifier;
SecAsn1Item encKey;
};
typedef struct SecCmsRecipientEncryptedKeyStr SecCmsRecipientEncryptedKey;
struct SecCmsKeyAgreeRecipientInfoStr {
SecAsn1Item version;
SecCmsOriginatorIdentifierOrKey originatorIdentifierOrKey;
SecAsn1Item ukm;
SECAlgorithmID keyEncAlg;
SecCmsRecipientEncryptedKey ** recipientEncryptedKeys;
};
typedef struct SecCmsKeyAgreeRecipientInfoStr SecCmsKeyAgreeRecipientInfo;
#define SEC_CMS_KEYAGREE_RECIPIENT_INFO_VERSION 3
struct SecCmsKEKIdentifierStr {
SecAsn1Item keyIdentifier;
SecAsn1Item * date;
SecAsn1Item * other;
};
typedef struct SecCmsKEKIdentifierStr SecCmsKEKIdentifier;
struct SecCmsKEKRecipientInfoStr {
SecAsn1Item version;
SecCmsKEKIdentifier kekIdentifier;
SECAlgorithmID keyEncAlg;
SecAsn1Item encKey;
};
typedef struct SecCmsKEKRecipientInfoStr SecCmsKEKRecipientInfo;
#define SEC_CMS_KEK_RECIPIENT_INFO_VERSION 4
typedef enum {
SecCmsRecipientInfoIDKeyTrans = 0,
SecCmsRecipientInfoIDKeyAgree = 1,
SecCmsRecipientInfoIDKEK = 2
} SecCmsRecipientInfoIDSelector;
struct SecCmsRecipientInfoStr {
SecCmsRecipientInfoIDSelector recipientInfoType;
union {
SecCmsKeyTransRecipientInfo keyTransRecipientInfo;
SecCmsKeyAgreeRecipientInfo keyAgreeRecipientInfo;
SecCmsKEKRecipientInfo kekRecipientInfo;
SecCmsKeyTransRecipientInfoEx keyTransRecipientInfoEx;
} ri;
SecCmsEnvelopedDataRef envelopedData;
SecCertificateRef cert;
};
struct SecCmsDigestedDataStr {
SecCmsContentInfo contentInfo;
SecAsn1Item version;
SECAlgorithmID digestAlg;
SecAsn1Item digest;
SecAsn1Item cdigest;
};
#define SEC_CMS_DIGESTED_DATA_VERSION_DATA 0
#define SEC_CMS_DIGESTED_DATA_VERSION_ENCAP 2
struct SecCmsEncryptedDataStr {
SecCmsContentInfo contentInfo;
SecAsn1Item version;
SecCmsAttribute ** unprotectedAttr;
};
#define SEC_CMS_ENCRYPTED_DATA_VERSION 0
#define SEC_CMS_ENCRYPTED_DATA_VERSION_UPATTR 2
typedef enum {
SecCmsKEAInvalid = -1,
SecCmsKEAUsesSkipjack = 0,
SecCmsKEAUsesNonSkipjack = 1,
SecCmsKEAUsesNonSkipjackWithPaddedEncKey = 2
} SecCmsKEATemplateSelector;
struct SecCmsSMIMEKEAParametersStr {
SecAsn1Item originatorKEAKey;
SecAsn1Item originatorRA;
SecAsn1Item nonSkipjackIV;
SecAsn1Item bulkKeySize;
};
struct SecCmsAttributeStr {
SecAsn1Item type;
SecAsn1Item ** values;
SECOidData * typeTag;
Boolean encoded;
};
#endif