cssmtype.h

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

H
1,558
字号
#define CSSM_KEYBLOB_RAW_FORMAT_PGP       4            /* PGP V??? */
#define CSSM_KEYBLOB_RAW_FORMAT_FIPS186   5            /* US Gov. FIPS 186 - DSS V??? */
#define CSSM_KEYBLOB_RAW_FORMAT_BSAFE     6            /* RSA Bsafe V3.0 */
#define CSSM_KEYBLOB_RAW_FORMAT_PKCS11    7            /* RSA PKCS11 V2.0 */
#define CSSM_KEYBLOB_RAW_FORMAT_CDSA      8            /* CDSA */
#define CSSM_KEYBLOB_RAW_FORMAT_CCA       9            /* CCA clear public key blob */
#define CSSM_KEYBLOB_RAW_FORMAT_PKCS8     10		   /* RSA PKCS8 V1.2 */
#define CSSM_KEYBLOB_RAW_FORMAT_OTHER     0xFFFFFFFF   /* Other, CSP defined */

/*
    Wrapped Format 
*/
#define CSSM_KEYBLOB_WRAPPED_FORMAT_NONE  0				/* No further conversion need to be done */
#define CSSM_KEYBLOB_WRAPPED_FORMAT_PKCS8 1				/* RSA PKCS8 V1.2 */
#define CSSM_KEYBLOB_WRAPPED_FORMAT_OTHER 0xFFFFFFFF    /* Other, CSP defined */

/*
    Reference Format
*/

#define CSSM_KEYBLOB_REF_FORMAT_INTEGER     0            /* Reference is a number or handle */
#define CSSM_KEYBLOB_REF_FORMAT_STRING      1           /* Reference is a string or name */
#define CSSM_KEYBLOB_REF_FORMAT_CCA         2           /* Reference is a CCA key token */
#define CSSM_KEYBLOB_REF_FORMAT_OTHER       0xFFFFFFFF  /* Other, CSP defined */


/*
    Key Class
*/

#define CSSM_KEYCLASS_PUBLIC_KEY     0                    /* Key is public key */
#define CSSM_KEYCLASS_PRIVATE_KEY    1                    /* Key is private key */
#define CSSM_KEYCLASS_SESSION_KEY    2                    /* Key is session or symmetric key */
#define CSSM_KEYCLASS_SECRET_PART    3                    /* Key is part of secret key */ 
#define CSSM_KEYCLASS_OTHER          0xFFFFFFFF            /* Other */ 


/*
    Key Use Flags
*/

#define CSSM_KEYUSE_ANY                 0x80000000
#define CSSM_KEYUSE_ENCRYPT             0x00000001
#define CSSM_KEYUSE_DECRYPT             0x00000002
#define CSSM_KEYUSE_SIGN                0x00000004
#define CSSM_KEYUSE_VERIFY              0x00000008
#define CSSM_KEYUSE_SIGN_RECOVER        0x00000010
#define CSSM_KEYUSE_VERIFY_RECOVER      0x00000020
#define CSSM_KEYUSE_WRAP                0x00000040
#define CSSM_KEYUSE_UNWRAP              0x00000080
#define CSSM_KEYUSE_DERIVE              0x00000100



/*
    CSSM_DATE
*/

typedef struct cssm_date {
    uint8 Year[4];                  /* 1997-9999, year 10000 problem!!! */
                                    /* For 1997 - Year[0] = '1'; Year[1] = '9'; 
                                       Year[2] = '9'; Year[3] = '7'; */
    uint8 Month[2];                 /* 01-12 */
    uint8 Day[2];                   /* 01-31 */
} CSSM_DATE, *CSSM_DATE_PTR;

/*
    CSSM_DATE_AND_TIME
*/

typedef struct cssm_date_and_time {
    sint32 Century;               /* 00-256 */
    sint32 Year;                  /* 00-99 */
    sint32 Month;                 /* 01-12 */
    sint32 Day;                   /* 01-31 */
    sint32 Hour;                  /* 00-23 */
    sint32 Minute;                /* 00-59 */
    sint32 Second;                /* 00-59 */
} CSSM_DATE_AND_TIME, *CSSM_DATE_AND_TIME_PTR;


/*
    CSSM_RANGE
*/
typedef struct cssm_range {
    uint32 Min;          /* inclusive minimium value */
    uint32 Max;          /* inclusive maximium value */
} CSSM_RANGE, *CSSM_RANGE_PTR;

typedef uint32 CSSM_HEADERVERSION;
/*
    CSSM_KEYHEADER
*/

typedef struct cssm_keyheader {
    CSSM_HEADERVERSION HeaderVersion;   /* Key header version */
    CSSM_GUID CspId;                    /* GUID of CSP generating the key */
    uint32 BlobType;                    /* See BlobType #define's */
    uint32 Format;                      /* Raw or Reference format */
    uint32 AlgorithmId;                 /* Algoritm ID of key */
    uint32 KeyClass;                    /* Public/Private/Secret etc. */
    uint32 EffectiveKeySizeInBits;      /* Size of actual key/modulus/prime in bits */
    uint32 KeyAttr;                     /* Attribute flags */
    uint32 KeyUsage;                    /* Key use flags */
    CSSM_DATE StartDate;                /* Effective date of key */
    CSSM_DATE EndDate;                  /* Expiration date of key */
    uint32 WrapAlgorithmId;             /* == CSSM_ALGID_NONE if clear key */
    uint32 WrapMode;                    /* if alg supports multiple wrapping modes */
    uint32 Reserved;
} CSSM_KEYHEADER, *CSSM_KEYHEADER_PTR;


/*
    CSSM_KEY
*/

typedef struct cssm_key    {
    CSSM_KEYHEADER KeyHeader;       /* Key header which is of fixed length */
    CSSM_DATA KeyData;              /* Key data which is of variable length */
} CSSM_KEY, *CSSM_KEY_PTR;

typedef CSSM_KEY CSSM_WRAP_KEY, *CSSM_WRAP_KEY_PTR;

#define CSSM_KEYHEADER_VERSION    (2)

typedef struct cssm_key_size {
    uint32 KeySizeInBits;            /* Key size in bits */
    uint32 EffectiveKeySizeInBits;   /* Effective key size in bits */
} CSSM_KEY_SIZE, *CSSM_KEY_SIZE_PTR;

typedef struct cssm_query_size_data {
    uint32 SizeInputBlock;
    uint32 SizeOutputBlock;
} CSSM_QUERY_SIZE_DATA, *CSSM_QUERY_SIZE_DATA_PTR;

typedef struct cssm_context_attribute{
    uint32 AttributeType;    /* one of the defined CSSM_ATTRIBUTE_TYPEs */
    uint32 AttributeLength;  /* length of attribute */
    union cssm_context_attribute_value {
        char *String;
        uint32 Uint32;
        CSSM_CRYPTO_DATA_PTR Crypto;
        CSSM_KEY_PTR Key;
        CSSM_DATA_PTR Data;
        CSSM_DATE_PTR Date;
        CSSM_RANGE_PTR Range;
        CSSM_VERSION_PTR Version;
    } Attribute;            /* data that describes attribute */
} CSSM_CONTEXT_ATTRIBUTE, *CSSM_CONTEXT_ATTRIBUTE_PTR;

typedef struct cssm_context {
    uint32 ContextType;        /* one of the defined CSSM_CONTEXT_TYPEs */
    uint32 AlgorithmType;      /* one of the defined CSSM_ALGORITHMSs */
    uint32 Reserve;            /* reserved for future use */
    uint32 NumberOfAttributes; /* number of attributes associated with context */
    CSSM_CONTEXT_ATTRIBUTE_PTR ContextAttributes;    /* pointer to attributes */
	CSSM_CSP_HANDLE CSPHandle;	/* TODO: Missing in API doc */    
} CSSM_CONTEXT, *CSSM_CONTEXT_PTR;

/* --- Key Recovery Policy API Flags --- */
#define KR_INDIV            0x01
#define KR_ENT              0x02
#define KR_LE               KR_LE_MAN | KR_LE_USE    
#define KR_LE_MAN           0x08
#define KR_LE_USE           0x10
#define KR_ALL              0x20
#define KR_OPTIMIZE         0x40
#define KR_DROP_WORKFACTOR  0x80


typedef CSSM_CONTEXT CSSM_CONTEXT_INFO;

/*
    CSSM_CSP_CAPABILITY
*/

typedef CSSM_CONTEXT CSSM_CSP_CAPABILITY, *CSSM_CSP_CAPABILITY_PTR;


/*
    CspType
*/
typedef enum cssm_csptype {
	CSSM_CSP_SOFTWARE	= 1, 
	CSSM_CSP_HARDWARE	= CSSM_CSP_SOFTWARE+1,
	CSSM_CSP_HYBRID = CSSM_CSP_SOFTWARE+2,
}CSSM_CSPTYPE; 

/*
    Software Csp SubService Info
*/

typedef struct cssm_softwarecspsubserviceinfo {
    uint32 NumberOfCapabilities;                /* Number of capabilities in list */
    CSSM_CSP_CAPABILITY_PTR CapabilityList;     /* List of capabilitites */
    void* Reserved;                             /* Reserved field */
} CSSM_SOFTWARE_CSPSUBSERVICE_INFO, *CSSM_SOFTWARE_CSPSUBSERVICE_INFO_PTR;


/*
    Hardware Csp SubService Info
*/

/* ReaderFlags */

#define CSSM_CSP_RDR_TOKENPRESENT  0x00000001    /* Token is present in reader/slot */
#define CSSM_CSP_RDR_EXISTS        0x00000002    /* Device is a reader with removable token */
#define CSSM_CSP_RDR_HW            0x00000004    /* Slot is a hardware slot */


/* TokenFlags */

#define CSSM_CSP_TOK_RNG                    0x00000001    /* Token has random number generator */ 
#define CSSM_CSP_TOK_WRITE_PROTECTED        0x00000002    /* Token is write protected */
#define CSSM_CSP_TOK_LOGIN_REQUIRED         0x00000004    /* User must login to access private obj */
#define CSSM_CSP_TOK_USER_PIN_INITIALIZED   0x00000008    /* User's PIN has been initialized */
#define CSSM_CSP_TOK_EXCLUSIVE_SESSION      0x00000010    /* An exclusive session currently exists */
#define CSSM_CSP_TOK_CLOCK_EXISTS           0x00000040    /* Token has built in clock */
#define CSSM_CSP_TOK_ASYNC_SESSION          0x00000080    /* Token supports asynchronous operations */
#define CSSM_CSP_TOK_PROT_AUTHENTICATION    0x00000100    /* Token has protected authentication path */
#define CSSM_CSP_TOK_DUAL_CRYPTO_OPS        0x00000200    /* Token supports dual crypto ops */
 

typedef struct cssm_hardwarecspsubserviceinfo {
    uint32 NumberOfCapabilities;                       /* Number of capabilities in list */
    CSSM_CSP_CAPABILITY_PTR CapabilityList;            /* List of capabilitites */
    void* Reserved;                                    /* Reserved field */

    /* Reader/Slot Info */
    CSSM_STRING ReaderDescription;
    CSSM_STRING ReaderVendor;
    CSSM_STRING ReaderSerialNumber;
    CSSM_VERSION ReaderHardwareVersion;
    CSSM_VERSION ReaderFirmwareVersion;
    uint32 ReaderFlags;                                /* See ReaderFlags #define's */
    uint32 ReaderCustomFlags;

    /* 
        Token Info, may not be available if reader supports removable device 
        AND device is not present.
    */
    CSSM_STRING TokenDescription;   
    CSSM_STRING TokenVendor;            
    CSSM_STRING TokenSerialNumber;    
    CSSM_VERSION TokenHardwareVersion;    
    CSSM_VERSION TokenFirmwareVersion;    
    
    uint32 TokenFlags;                                /* See TokenFlags #defines's */
    uint32 TokenCustomFlags;
    uint32 TokenMaxSessionCount;
    uint32 TokenOpenedSessionCount;
    uint32 TokenMaxRWSessionCount;
    uint32 TokenOpenedRWSessionCount;
    uint32 TokenTotalPublicMem;
    uint32 TokenFreePublicMem;
    uint32 TokenTotalPrivateMem;
    uint32 TokenFreePrivateMem;
    uint32 TokenMaxPinLen;
    uint32 TokenMinPinLen;
    char TokenUTCTime[16];

    /*
        User Info, may not be available if reader supports removable device 
        AND device is not present.
    */
    CSSM_STRING UserLabel;
    CSSM_DATA UserCACertificate;                    /* Certificate of CA */ 

} CSSM_HARDWARE_CSPSUBSERVICE_INFO, *CSSM_HARDWARE_CSPSUBSERVICE_INFO_PTR;

typedef CSSM_HARDWARE_CSPSUBSERVICE_INFO
				CSSM_HYBRID_CSPSUBSERVICE_INFO, * CSSM_HYBRID_CSPSUBSERVICE_INFO_PTR;


/*
    CSSM_CSP_WRAPPEDPRODUCTINFO
*/

/* (Wrapped)ProductFlags */
/* None curently defined */

typedef struct cssm_csp_wrappedproductinfo {
    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 */
    uint32 ProductFlags;              /* ProductFlags */
	uint32 ProductCustomFlags;
} CSSM_CSP_WRAPPEDPRODUCTINFO, *CSSM_CSP_WRAPPEDPRODUCTINFO_PTR;

/*
    CSSM_CSPINFO
*/

/* CspFlags */
typedef uint32 CSSM_CSP_FLAGS;
#define CSSM_CSP_STORES_PRIVATE_KEYS    0x00000001    /* CSP can store private keys */
#define CSSM_CSP_STORES_PUBLIC_KEYS     0x00000002    /* CSP can store public keys */
#define CSSM_CSP_STORES_SESSION_KEYS    0x00000004    /* CSP can store session/secret keys */

typedef struct cssm_cspsubservice {
    uint32 SubServiceId;
    CSSM_STRING Description;
    CSSM_CSP_FLAGS CspFlags;       /* General flags defined by CSSM for CSPs */   
    uint32 CspCustomFlags;         /* Flags defined by individual CSP */  
    uint32 AccessFlags;            /* Access Flags used by CSP */
    CSSM_CSPTYPE CspType;          /* CSP type number for dereferencing CspInfo*/
    union cssm_subservice_info {   /* info struct of type defined by CspType */
        CSSM_SOFTWARE_CSPSUBSERVICE_INFO SoftwareCspSubService;
        CSSM_HARDWARE_CSPSUBSERVICE_INFO HardwareCspSubService;
		CSSM_HYBRID_CSPSUBSERVICE_INFO HybridCspSubService;

⌨️ 快捷键说明

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