本文整理汇总了C++中CK_FUNCTION_LIST_PTR::C_VerifyInit方法的典型用法代码示例。如果您正苦于以下问题:C++ CK_FUNCTION_LIST_PTR::C_VerifyInit方法的具体用法?C++ CK_FUNCTION_LIST_PTR::C_VerifyInit怎么用?C++ CK_FUNCTION_LIST_PTR::C_VerifyInit使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CK_FUNCTION_LIST_PTR
的用法示例。
在下文中一共展示了CK_FUNCTION_LIST_PTR::C_VerifyInit方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1:
int testStability_verify
(
CK_SESSION_HANDLE hSession,
CK_OBJECT_HANDLE hPublicKey,
CK_BYTE_PTR pData,
CK_ULONG ulDataLen,
CK_BYTE_PTR pSignature,
CK_ULONG ulSignatureLen
)
{
CK_RV rv;
CK_MECHANISM mechanism = {
CKM_RSA_PKCS, NULL_PTR, 0
};
rv = p11->C_VerifyInit(hSession, &mechanism, hPublicKey);
if (rv != CKR_OK)
{
printf("ERROR: Failed to initialize verification. rv=%s\n", rv2string(rv));
return 1;
}
rv = p11->C_Verify(hSession, pData, ulDataLen, pSignature, ulSignatureLen);
if (rv != CKR_OK)
{
printf("ERROR: Failed to verify signature. rv=%s\n", rv2string(rv));
return 1;
}
return 0;
}
示例2: DataMarshalling
//.........这里部分代码省略.........
if (data != NULL) {
data = (char *)calloc(1, dataLen);
if (!data) {
printf("ERROR: NO MEM C_Sign\n");
break;
}
d->unpackMem((char *)data, dataLen);
}
signatureLen = d->unpackInt();
signature = (char *)d->unpackInt();
if (signature != NULL) {
signature = (char *)calloc(1, signatureLen);
if (!signature) {
printf("ERROR: NO MEM C_Sign\n");
break;
}
d->unpackMem((char *)signature, signatureLen);
}
{
CK_RV ret = 0;
DataMarshalling *d2 = new DataMarshalling(client);
/*
* Opening session
*/
ret = pFunctionList->C_Sign(sessionId, (CK_BYTE_PTR)data, dataLen, (CK_BYTE_PTR)signature, &signatureLen);
d2->setMsgType(d->getMsgType());
d2->packInt((char *)&ret);
d2->packInt((char *)&signatureLen);
if (signature != NULL)
d2->packMem((char *)signature, signatureLen);
d2->sendData();
delete d2;
}
} else if (!strcmp(d->getMsgType(), "C_VerifyInit")) {
CK_SESSION_HANDLE sessionId = 0;
CK_MECHANISM mechanism;
CK_OBJECT_HANDLE hKey;
printf("Processing: C_VerifyInit\n");
sessionId = d->unpackInt();
hKey = d->unpackInt();
mechanism.mechanism = d->unpackInt();
mechanism.ulParameterLen = d->unpackInt();
mechanism.pParameter = NULL;
{
CK_RV ret = 0;
DataMarshalling *d2 = new DataMarshalling(client);
/*
* Opening session
*/
ret = pFunctionList->C_VerifyInit(sessionId, &mechanism, hKey);
d2->setMsgType(d->getMsgType());
d2->packInt((char *)&ret);
d2->sendData();
delete d2;
}
} else if (!strcmp(d->getMsgType(), "C_Verify")) {
CK_SESSION_HANDLE sessionId = 0;
char *data = NULL, *signature = NULL;
CK_ULONG dataLen = 0, signatureLen = 0;
printf("Processing: C_Verify\n");
sessionId = d->unpackInt();
dataLen = d->unpackInt();