cssmtype.h

来自「Next BIOS Source code : Extensible Firmw」· C头文件 代码 · 共 1,558 行 · 第 1/5 页

H
1,558
字号
    } SubServiceInfo;
    CSSM_CSP_WRAPPEDPRODUCTINFO WrappedProduct;    /* Pointer to wrapped product info */
} CSSM_CSPSUBSERVICE, *CSSM_CSPSUBSERVICE_PTR;

#define CSSM_VALUE_NOT_AVAILABLE    (0xFFFFFFFF)

/* 
    Key Attribute Flags
*/
/* Valid only during call to an API. Will never be valid when set in a key header */
#define CSSM_KEYATTR_RETURN_DEFAULT   0x00000000
#define CSSM_KEYATTR_RETURN_DATA      0x10000000
#define CSSM_KEYATTR_RETURN_REF       0x20000000
#define CSSM_KEYATTR_RETURN_NONE      0x40000000

/* Valid during an API call and in a key header */
#define CSSM_KEYATTR_PERMANENT        0x00000001
#define CSSM_KEYATTR_PRIVATE          0x00000002
#define CSSM_KEYATTR_MODIFIABLE       0x00000004
#define CSSM_KEYATTR_SENSITIVE        0x00000008
#define CSSM_KEYATTR_EXTRACTABLE      0x00000020

/* Valid only in a key header generated by a CSP, not valid during an API call */
#define CSSM_KEYATTR_ALWAYS_SENSITIVE 0x00000010
#define CSSM_KEYATTR_NEVER_EXTRACTABLE 0x00000040

/* The effects of specifying the EXTRACTABLE & SENSATIVE bits in an API call
 * is summarized in this table.
 * SENSATIVE  EXTRACTABLE    Effect
 * ---------- ----------------- --------------------------------------------
 * FALSE      TRUE                Key extractable wrapped or plaintext
 * TRUE       TRUE                Key extractable only when wrapped
 *                                *This mode is an error condition for Cryptoki v1.0
 * TRUE/FALSE FALSE                Key NEVER extractable in any form
 *                                *Sensative forced to TRUE for Cryptoki v1.0
 */

#define CSSM_ESTIMATED_TIME_UNKNOWN	-1

typedef struct cssm_field {
    CSSM_OID FieldOid;
    CSSM_DATA FieldValue;
} CSSM_FIELD, *CSSM_FIELD_PTR;

/*
 * This data structure contains parameters useful in verifying certificate groups,
 * certificate revocation lists and other forms of signed document.
 */
typedef struct cssm_verify_context {
	CSSM_FIELD_PTR  PolicyIdentifiers;
	uint32 NumberofPolicyIdentifiers;
	CSSM_TP_STOP_ON VerificationAbortOn; 
	CSSM_USER_AUTHENTICATION_PTR UserAuthentication;
	CSSM_DATA_PTR AnchorCerts;
	uint32 NumberofAnchorCerts;
	CSSM_FIELD_PTR VerifyScope;
	uint32 ScopeSize;
	CSSM_TP_ACTION Action;
	CSSM_NOTIFY_CALLBACK CallbackWithVerifiedCert;
	CSSM_DATA_PTR ActionData;
	CSSM_EVIDENCE_PTR *Evidence;
	uint32 *NumberOfEvidences;
} CSSM_VERIFYCONTEXT, *CSSM_VERIFYCONTEXT_PTR; 


typedef struct cssm_tp_wrappedproductinfo {
    CSSM_VERSION StandardVersion;                           /* Version of standard this product conforms to */
    CSSM_STRING StandardDescription;  /* Description of standard this product conforms to */
    CSSM_STRING ProductVendor;        /* Vendor of wrapped product/library */
    uint32 ProductFlags;                                    /* ProductFlags */
} CSSM_TP_WRAPPEDPRODUCTINFO, *CSSM_TP_WRAPPEDPRODUCTINFO_PTR;

typedef struct cssm_tpsubservice {
    uint32 SubServiceId;
    CSSM_STRING Description; /* Description of this sub service */
    CSSM_CERT_TYPE CertType;       /* Type of certificate accepted by the TP */
	CSSM_CERT_ENCODING CertEncoding; 	/* Encoding of cert accepted by TP */
    CSSM_USER_AUTHENTICATION_MECHANISM AuthenticationMechanism; 
    uint32 NumberOfPolicyIdentifiers;    
    CSSM_FIELD_PTR PolicyIdentifiers;
    CSSM_TP_WRAPPEDPRODUCTINFO WrappedProduct;  /* Pointer to wrapped product info */
} CSSM_TPSUBSERVICE, *CSSM_TPSUBSERVICE_PTR;

/*
 * Structure to describe the attributes of the CSSM infrastructure.
 */
typedef struct cssm_cssminfo {
    CSSM_VERSION Version; 
    CSSM_STRING Description;	/* Description of CSSM */ 
    CSSM_STRING Vendor;		/* Vendor of CSSM */
    CSSM_BOOL ThreadSafe;
    char Location[CSSM_MAX_PATH];
    CSSM_GUID CssmGUID;
	CSSM_GUID InterfaceGUID;	/* opt GUID defining supported interface */
}CSSM_CSSMINFO, *CSSM_CSSMINFO_PTR;


/*
 * This enumerated type lists the signed certificate aggregates that are 
 * considered to be certificate bundles.
 */
typedef enum cssm_cert_bundle_type {
	CSSM_CERT_BUNDLE_UNKNOWN =  0x00,
	CSSM_CERT_BUNDLE_CUSTOM  =  0x01,
	CSSM_CERT_BUNDLE_PKCS7_SIGNED_DATA =  0x02,
	CSSM_CERT_BUNDLE_PKCS7_SIGNED_ENVELOPED_DATA =  0x03,
	CSSM_CERT_BUNDLE_PKCS12 =  0x04,
	CSSM_CERT_BUNDLE_PFX =  0x05,
	CSSM_CERT_BUNDLE_LAST = 0x7FFF
} CSSM_CERT_BUNDLE_TYPE;

/* 
 * Applications wishing to define their own custom certificate 
 * BUNDLE type should create a random uint32 whose value
 * is greater than the CSSM_CL_CUSTOM_CERT_BUNDLE_TYPE 
 */
#define CSSM_CL_CUSTOM_CERT_BUNDLE_TYPE  0x8000 

/*
 * This enumerated type lists the encoding methods applied to the signed 
 * certificate aggregates that are considered to be certificate bundles.
 */

typedef enum cssm_cert_bundle_encoding {
    CSSM_CERT_BUNDLE_ENCODING_UNKNOWN =  0x00,
	CSSM_CERT_BUNDLE_ENCODING_CUSTOM  =  0x01,
	CSSM_CERT_BUNDLE_ENCODING_BER     =  0x02,
	CSSM_CERT_BUNDLE_ENCODING_DER     =  0x03
} CSSM_CERT_BUNDLE_ENCODING;

/*
 * This structure defines a bundle header, which describes the type and encoding
 * of a certificate bundle.
 */
typedef struct cssm_cert_bundle_header {
	CSSM_CERT_BUNDLE_TYPE BundleType;
	CSSM_CERT_BUNDLE_ENCODING BundleEncoding;
} CSSM_CERT_BUNDLE_HEADER, *CSSM_CERT_BUNDLE_HEADER_PTR;

/*
 * This structure defines a certificate bundle, which consists of a descriptive 
 * header and a pointer to the opaque bundle. The bundle itself is a signed opaque 
 * aggregate of certificates.
 */
 typedef struct cssm_cert_bundle {
	CSSM_CERT_BUNDLE_HEADER BundleHeader;
	CSSM_DATA Bundle;
} CSSM_CERT_BUNDLE, *CSSM_CERT_BUNDLE_PTR;


typedef uint32 CSSM_CA_SERVICES;
/*  bit masks for additional CA services at cert enroll  */
#define    CSSM_CA_KEY_ARCHIVE        0x0001
#define    CSSM_CA_CERT_PUBLISH        0x0002
#define    CSSM_CA_CERT_NOTIFY_RENEW    0x0004
#define	CSSM_CA_CERT_DIR_UPDATE	0x0008	/* multi-signed cert to dir svc */
#define	CSSM_CA_CRL_DISTRIBUTE	0x0010 /* push CRL to everyone */ 

/*
    CSSM_CL_WRAPPEDPRODUCTINFO
*/

/* CL_CA_ProductInfo */
typedef struct cssm_cl_ca_cert_classinfo {
    CSSM_STRING CertClassName;        /* Name of a cert class issued by this CA */
    CSSM_DATA CACert;                 /* CA Certificate for this cert class */
} CSSM_CL_CA_CERT_CLASSINFO, *CSSM_CL_CA_CERT_CLASSINFO_PTR;

typedef struct cssm_cl_ca_productinfo {
    CSSM_VERSION StandardVersion;     /* Version of standard this product conforms to */
    CSSM_STRING StandardDescription;  /* Description of standard this product conforms to */
    CSSM_VERSION ProductVersion;      /* Version of wrapped product/library */
    CSSM_STRING ProductDescription;   /* Description of wrapped product/library */
    CSSM_STRING ProductVendor;        /* Vendor of wrapped product/library */
	CSSM_NET_PROTOCOL NetworkProtocol;/* The network protocol supported by the CA service */

    CSSM_CERT_TYPE CertType;		  /* Type of certs and CRLs supported by the CA */
    CSSM_CERT_ENCODING CertEncoding; /* Encoding of certs supported by CA */
    CSSM_CRL_TYPE CrlType; /* Type of CRLs supported by CA */
    CSSM_CRL_ENCODING CrlEncoding; /* Encoding of CRLs supported by CA */

    CSSM_CA_SERVICES AdditionalServiceFlags;/* Mask of additional services a caller can request */
    uint32 NumberOfCertClasses;             /* Number of different cert types or classes the CA can issue */
    CSSM_CL_CA_CERT_CLASSINFO_PTR CertClasses;                                  
} CSSM_CL_CA_PRODUCTINFO, *CSSM_CL_CA_PRODUCTINFO_PTR;

/* CL_Encoder_ProductInfo */
typedef struct cssm_cl_encoder_productinfo {
    CSSM_VERSION StandardVersion;       /* Version of standard this product conforms to */
    CSSM_STRING StandardDescription;  /* Description of standard this product conforms to */
    CSSM_VERSION ProductVersion;        /* Version of wrapped product/library */
    CSSM_STRING ProductDescription; /* Description of wrapped product/library */
    CSSM_STRING ProductVendor;    /* Vendor of wrapped product/library */       
    CSSM_CERT_TYPE CertType;            /* Type of certs and CRLs supported by the CA */
	CSSM_CRL_TYPE CrlType; /* Type of crls supported by encoder */
    uint32 ProductFlags;                /* Mask of selectable encoder features actually used by the CL */
} CSSM_CL_ENCODER_PRODUCTINFO, *CSSM_CL_ENCODER_PRODUCTINFO_PTR;

typedef struct cssm_cl_wrappedproductinfo {
    /* List of encode/decode/parse libraries embedded in the CL module */
    CSSM_CL_ENCODER_PRODUCTINFO_PTR EmbeddedEncoderProducts;    /* library product description */
    uint32 NumberOfEncoderProducts;     /* number of encode/decode/parse libraries used in CL */

    /* List of CAs accessible to the CL module */
    CSSM_CL_CA_PRODUCTINFO_PTR AccessibleCAProducts;            /* CA product description*/
    uint32 NumberOfCAProducts;    /* Number of accessible CAs */
} CSSM_CL_WRAPPEDPRODUCTINFO, *CSSM_CL_WRAPPEDPRODUCTINFO_PTR;


typedef struct cssm_clsubservice {
	uint32 SubServiceId;
	CSSM_STRING Description;  
	CSSM_CERT_TYPE CertType;
	CSSM_CERT_ENCODING CertEncoding;
	uint32 NumberOfBundleInfos; 
	CSSM_CERT_BUNDLE_HEADER_PTR BundleInfo;   /* first is default value */
	CSSM_USER_AUTHENTICATION_MECHANISM AuthenticationMechanism;
	uint32 NumberOfTemplateFields;
	CSSM_OID_PTR CertTemplate;
	uint32 NumberOfTranslationTypes;
	CSSM_CERT_TYPE_PTR CertTranslationTypes;
	CSSM_CL_WRAPPEDPRODUCTINFO WrappedProduct;
} CSSM_CLSUBSERVICE, *CSSM_CLSUBSERVICE_PTR;


#define CSSM_NOTIFY_SURRENDER           0
#define CSSM_NOTIFY_COMPLETE            1
#define CSSM_NOTIFY_DEVICE_REMOVED      2
#define CSSM_NOTIFY_DEVICE_INSERTED     3


#define CSSM_CSP_SESSION_EXCLUSIVE        0x0001 
#define CSSM_CSP_SESSION_READWRITE        0x0002
#define CSSM_CSP_SESSION_SERIAL           0x0004


#define CSSM_DL_STORE_ACCESS_SERIAL       CSSM_CSP_SESSION_SERIAL
#define CSSM_DL_STORE_ACCESS_EXCLUSIVE    CSSM_CSP_SESSION_EXCLUSIVE
#define CSSM_DL_STROE_ACCESS_READWRITE    CSSM_CSP_SESSION_READWRITE


/*
 * VL Data types 
 */
typedef CSSM_GUID CSSM_VOBUNDLE_UID, *CSSM_VOBUNDLE_UID_PTR;
typedef CSSM_GUID CSSM_VO_UID, *CSSM_VO_UID_PTR;
typedef uint32    CSSM_VL_VERIFICATION_HANDLE, *CSSM_VL_VERIFICATION_HANDLE_PTR;

typedef struct cssm_vo_uid_binding {
	CSSM_VO_UID VoIdentifier;
	CSSM_VO_HANDLE VoHandle;
} CSSM_VO_UID_BINDING, *CSSM_VO_UID_BINDING_PTR;

typedef struct cssm_vo_uid_binding_group {
	uint32 NumberOfBindings;
	CSSM_VO_UID_BINDING_PTR Bindings;
} CSSM_VO_UID_BINDING_GROUP, *CSSM_VO_UID_BINDING_GROUP_PTR;

/* VL Locations */
typedef enum cssm_vl_media_type {
    CSSM_VL_MEDIA_TYPE_UNKNOWN = 0, 
    CSSM_VL_MEDIA_TYPE_CUSTOM = 1, 
    CSSM_VL_MEDIA_TYPE_VODIRECTORY = 2,
    CSSM_VL_MEDIA_TYPE_DLM = 3,
    CSSM_VL_MEDIA_TYPE_FILE = 4,
    CSSM_VL_MEDIA_TYPE_REMOTE = 5,
    CSSM_VL_MEDIA_TYPE_MEMORY = 6,
	CSSM_VL_MEDIA_TYPE_EMBEDDED = 7
} CSSM_VL_MEDIA_TYPE;

#define CSSM_VL_CUSTOM_MEDIA_ACCESS_SIZE_ARBITRARY 0
#define CSSM_VL_CUSTOM_MEDIA_ACCESS_GET 0x01
#define CSSM_VL_CUSTOM_MEDIA_ACCESS_PUT 0x02

typedef struct cssm_vl_location_custom  {
	CSSM_STRING ByteSourceName;
	uint32 ByteBlockSize;
	CSSM_HANDLE (*OpenMedia) (CSSM_STRING ByteSourceName, uint32 AccessMode);
	uint32      (*GetBytes)  (CSSM_HANDLE MediaHandle, CSSM_DATA_PTR ByteBuffer);
	uint32      (*PutBytes)  (CSSM_HANDLE MediaHandle, CSSM_DATA_PTR ByteBuffer);	
    CSSM_RETURN (*CloseMedia)(CSSM_HANDLE MediaHandle);
} CSSM_VL_LOCATION_CUSTOM, *CSSM_VL_LOCATION_CUSTOM_PTR;

typedef CSSM_VOBUNDLE_UID CSSM_VL_LOCATION_VODIRECTORY, *CSSM_VL_LOCATION_VODIRECTORY_PTR;

typedef struct cssm_vl_location_dlm {
    CSSM_SUBSERVICE_UID DLSubserviceUID;
    CSSM_STRING DbName;
    CSSM_DB_ATTRIBUTE_DATA DbPrimaryKeyValue;
} CSSM_VL_LOCATION_DLM, *CSSM_VL_LOCATION_DLM_PTR;

typedef struct cssm_vl_location_file {
    char *PathName;
    char *FileName;
} CSSM_VL_LOCATION_FILE, *CSSM_VL_LOCATION_FILE_PTR;

/*
 * This enumerated type defines representations for specifying the location 
 * of a service.
 */
typedef enum cssm_net_address_type {
	CSSM_ADDR_NONE = 0,
	CSSM_ADDR_CUSTOM = 1,
	CSSM_ADDR_URL = 2, /* char* */
	CSSM_ADDR_SOCKADDR = 3,
	CSSM_ADDR_NAME = 4 /* char* - qualified by access method */
} CSSM_NET_ADDRESS_TYPE;

/*
 * 

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?