HP-UX Kernel Cryptographic Module 2.1 User Guide (766149-002, April 2014)
Table 2 Functions supported by HP-UX KCM (continued)
DescriptionFunctionCategory
Unwraps (decrypts) a keyC_UnwrapKey
Generates random dataC_GenerateRandomRandom number generation
functions
For more information on APIs, see PKCS#11 specifications document.
Example usage of HP-UX KCM
// pkcs11 header files
#include "pkcs11_kcm.h"
#include "pkcs11.h"
// Initialize the module. Required only once during lifetime of the application
CK_RV rv = C_Initialize( NULL_PTR );
// Open session. Required for every crypto operation
CK_SESSION_HANDLE hSession;
rv = C_OpenSession( 0, 0, NULL, NULL, );
// Set mechanism – type of crypto operation
CK_MECHANISM digestMechanism = { 0, NULL, 0 };
digestMechanism.mechanism = CKM_SHA256;
// Initialize crypto operation
rv = C_DigestInit( hSession, );
// prepare input and output buffers
uint8_t input[] = {'a', 'b', 'c'};
uint8_t digest[64];
uint32_t inputlen = sizeof( input );
uint64_t digestlen = sizeof( digest )
// Invoke crypto operation
rv = C_Digest( hSession, input, inputlen, digest, );
// Close crypto session
rv = C_CloseSession( hSession )
// Call this at the end of all crypto operations
rv = C_Finalize( NULL_PTR );
PKCS #11 API considerations 9