📄 cmtcmn.h
字号:
* digest. * digest * The actual digest of the data. * ciRID * A pointer to a pre-allocated chunk of memory where the library * can place the resource ID of the content info created by the psm * server. * errCode * A pointer to a pre-allocated chunk of memory where the library * can place the error code returned by the psm server in case of * error. NOTE: The error codes need to be documented. * NOTES * This function creates a PKCS7 Content Info on the psm server that will * be used to sign the digest. After creating this content info the * application must use CMT_PKCS7Encoder{Start|Update|Finish} function * calls to encode the content info. * Currently there is only one supported value for digest algorithm: * Digest Algorithm Value * ---------------- ----- * SHA1 4 * * RETURN * A return value of CMTSuccess indicates the content info was successfully * created on the psm server and the application can proceed to encode the * content info with CMT_PKCS7Encoder* function calls. Any other return * value indicates an error and the content info was not created. */CMTStatus CMT_CreateSigned(PCMT_CONTROL control, CMUint32 scertID, CMUint32 ecertID, CMUint32 dig_alg, CMTItem *digest,CMUint32 *ciRID,CMInt32 *errCode);/* * FUNCTION: CMT_PKCS7EncoderStart * ------------------------------ * INPUTS * control * A control connection that has established a connection with the * psm server. * ciRID * The resource ID of the content info to encode. * connectionID * A pointer to a pre-allocated chunk of memory where the library can * place the resource ID of the resulting PKCS7 Encoder Context. * cb * A callback function that will get called as the content info * is encoded. * cb_arg * An opaque pointer that will get passed to cb every time cb is * called. * * NOTES * This function creates a PKCS7 encoder context on the psm server which * the application can use to encode a data as a PKCS7 content info. The * function cb will be used to pass back encoded buffers to the application. * The applicaton should concatenate the buffer passed in to cb to any buffer * previously passed in to the function cb. The concatenation of all the * buffers passed in to cb will be the final product of the encoding * procedure. * * RETURN * A return value of CMTSuccess indicates successful creation of a PKCS7 * encoder context on the psm server. Any other return value indicates * an error and that no encoder context was created on the psm server. */CMTStatus CMT_PKCS7EncoderStart(PCMT_CONTROL control, CMUint32 ciRID, CMUint32 *connectionID, CMTP7ContentCallback cb, void *cb_arg);/* * FUNCTION: CMT_PKCS7EncoderUpdate * -------------------------------- * INPUTS * control * A control connection that has established a connection with the * psm server. * connectionID * The resource ID of a PKCS7 Encoder context returned by the function * CMT_PKCS7EncoderStart * buf * The next chunk of buffer to set as the data of the content info. * len * The length of the buffer passed in. * * NOTES * This function sets the next buffer to include as part of the content to * encode. The application can repeatedly call this function until all the * data has been fed to the encoder context. * * RETURN * A return value of CMTSuccess indicates the the encoder context on the psm * server successfully added the data to the encoder context. Any other * return value indicates an error. * */CMTStatus CMT_PKCS7EncoderUpdate(PCMT_CONTROL control, CMUint32 connectionID, const char *buf, CMUint32 len);/* * FUNCTION: CMT_PKCS7EncoderFinish * -------------------------------- * INPUTS: * control * A control connection that has established a connection with the * psm server. * connectionID * The resource ID of a PKCS7 Encoder context returned by the function * CMT_PKCS7EncoderStart * * NOTES * This function destroys the PKCS7 encoder context with the resource ID of * connectionID on the psm server. * * RETURN * A return value of CMTSuccess indicates the PKCS7 encoder context was * successfully destroyed. Any other return value indcates an error while * trying to destroy the PKCS7 encoder context. */CMTStatus CMT_PKCS7EncoderFinish(PCMT_CONTROL control, CMUint32 connectionID);/* Hash functions *//* * FUNCTION: CMT_HashCreate * ------------------------ * INPUTS: * control * A control connection that has established a connection with the * psm server. * algID * A numeric value representing what kind of hash to perform. * connID * A pointer to a pre-allocated chunk of memory where the library * can place a copy of the resource ID associated with the hashing * context created by this function. * NOTES * This function sends a message to the psm server requesting a context be * created for performing a hashing operation. The type of hashing operation * performed depends on the parameter passed in for algID. The valid values * are: * * Hash Algorithm Value * -------------- ----- * MD2 1 * MD5 2 * SHA1 3 * * RETURN * A return value of CMTSuccess indicates successful creation of a hashing * context ont he psm server. The resource ID of the hashing context is * located at *connID. Any other return value indicates an error and the * value at *connID should be ignored. */CMTStatus CMT_HashCreate(PCMT_CONTROL control, CMUint32 algID, CMUint32 * connID);/* * FUNCTION: CMT_HASH_Destroy * -------------------------- * INPUTS: * control * A control connection that has established a connection with the * psm server. * connectionID * The resource ID of the Hash context on psm to destroy. * NOTES * This function sends a message to the psm server requesting that the hashing * context with the resource ID of "connectionID" be destroyed. This function * should be called after the hashing context is no longe needed. * * RETURN * A return value of CMTSuccess indicates the hashing context was successfully * destroyed. Any other return value indicates an error while destroying * the resource with resource ID connectionID. */CMTStatus CMT_HASH_Destroy(PCMT_CONTROL control, CMUint32 connectionID);/* * FUNCTION: CMT_HASH_Begin * ------------------------ * INPUTS: * control * A control connection that has established a connection with the * psm server. * connectionID * The resource ID of a hashing context on the psm server. * NOTES * This function will send a message to the psm server requesting the hashing * context initialize its internal state before beginning the process of hasing * data. * * RETURN * A return value of CMTSuccess indicates the state of the hashing context * successfully initialized its state and that the application can start * feeding the data to hash via the CMT_HASH_Update function. Any other return * value indicates an error and the hashing context should not be used after * this function call. */CMTStatus CMT_HASH_Begin(PCMT_CONTROL control, CMUint32 connectionID);/* * FUNCTION: CMT_HASH_Update * ------------------------- * INPUTS: * control * A control connection that has established a connection with the * psm server. * connectionID * The resource ID of a hashing context on the psm server. * buf * The data to feed to the hashing context. * len * The length of the buffer passed in as data. * * NOTES * This function sends the next buffer of data to be hashed as part * of the hash context associated with the parameter connecionID. The * application may call this function multiple times each time feeding * in the next chunk of data to be hashed. The end result will be the hash * of the concatenation of the data passed into each successive call to * CMT_HASH_Update. To get the final hash of the data call CMT_HASH_End * after feeding all of the data to the context via this function. * * RETURN * A return value of CMTSuccess indicates the hash context on the psm server * successfully accepted the data and updated its internal state. Any other * return value indicates an error and the state of the hashing context is * undefined from this point forward. */CMTStatus CMT_HASH_Update(PCMT_CONTROL control, CMUint32 connectionID, const unsigned char * buf, CMUint32 len);/* * FUNCTION: CMT_HASH_End * ---------------------- * INPUTS: * control * A control connection that has established a connection with the * psm server. * connectionID * The resource ID of a hashing context on the psm server. * result * A pre-allocated buffer where the library can place the hash of * the data that was fed to the hashing context. * resultlen * A pointer to a pre-allocated CMUint32 where the library can place * the length of the hash returned via the parameter result. * maxLen * The alocated length of the buffer "result" that is passed in. The * library will not write the hash out to "result" if the length of * the hash of the data is greater than this parameter. * * NOTES * This function tells the psm server that no more data will be fed to * the hashing context. The hashing context finishes its hashing operation * and places the final hash of the processed data in the buffer result and * places the length of the resultant hash at *result. * * RETURN * A return value of CMTSuccess indicates the hashing context successfully * finished the hashing operation and placed the resulting hash in the buffer * "result" as well as the hash's length at *resultLen. Any other return * value indicates an error and the values in buffer and *resultLen should * ignored. */CMTStatus CMT_HASH_End(PCMT_CONTROL control, CMUint32 connectionID, unsigned char * result, CMUint32 * resultlen, CMUint32 maxLen);/* Resources *//* * FUNCTION: CMT_GetNumericAttribute * --------------------------------- * control * A control connection that has established a connection with the * psm server. * resourceID * The resource ID of the resource on the psm server which the * application wants to retrieve an attribute for. * fieldID * The numerical representation of the attribute the application wants * to retrieve. * value * A pointer to a pre-allocated CMUint32 where the library can place * a copy of the numeric attribute retrieved from the resource on the * psm server * * NOTES * This function requests that the psm server query a resource for a numeric * attribute. The fieldID should be one of the enumerations defined by * the enumeration SSMAttributeID. Each resource has a set of attributes * that can be retrieved from the psm server. Refer to the function where * a resource is created for a list of attributes that a given resource has. * * RETURN * A return value of CMTSuccess indicates the resource on the psm server * returned the requested numeric attribute and the corresponding attribute * value can be found at *value. Any other return value indicates an error * and the value at *value should be ignored. */CMTStatus CMT_GetNumericAttribute(PCMT_CONTROL control, CMUint32 resourceID, CMUint32 fieldID, CMInt32* value);/* * FUNCTION: CMT_GetStringAttribute * -------------------------------- * control * A control connection that has established a connection with the * psm server. * resourceID * The resource ID of the resource on the psm server which the * application wants to retrieve an attribute for. * fieldID * The numerical representation of the attribute the application wants * to retrieve. * value * A pinter to a CMTItem that the library can store the string attribute * retrieved from the resource on the psm server. * * NOTES * This function requests that the psm server query a resource for a string * attribute. The fieldID should be one of the enumerations defined by * the enumeration SSMAttributeID. Each resource has a set of attributes * that can be retrieved from the psm server. Refer to the function where * a resource is created for a list of attributes that a given resource has. * * RETURN * A return value of CMTSuccess indicates the resource on the psm server * returned the requested string attribute and the corresponding attribute * value can be found at *value. Any other return value indicates an error * and the value at *value should be ignored. */CMTStatus CMT_GetStringAttribute(PCMT_CONTROL control, CMUint32 resourceID, CMUint32 fieldID, CMTItem *value);/*
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -