本文整理汇总了C++中LPPROTOCOLIMPL::SetupSecureMemoryTag方法的典型用法代码示例。如果您正苦于以下问题:C++ LPPROTOCOLIMPL::SetupSecureMemoryTag方法的具体用法?C++ LPPROTOCOLIMPL::SetupSecureMemoryTag怎么用?C++ LPPROTOCOLIMPL::SetupSecureMemoryTag使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类LPPROTOCOLIMPL
的用法示例。
在下文中一共展示了LPPROTOCOLIMPL::SetupSecureMemoryTag方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1:
/*
// Expects
// SEQUENCE {
// macKeyName [1] OCTET STRING OPTIONAL,
// macKey OCTET STRING,
// cipherKeyName [2] OCTET STRING OPTIONAL,
// cipherKey OCTET STRING OPTIONAL
// }
*/
SKYETEK_STATUS
Iso14443ATag_SetupSecureMemoryTag(
LPSKYETEK_READER lpReader,
LPSKYETEK_TAG lpTag,
LPSKYETEK_KEY lpKeyHMAC,
LPSKYETEK_KEY lpKeyCipher,
int useKeyDerivationFunction
)
{
LPPROTOCOLIMPL lppi;
SKYETEK_STATUS status;
LPSKYETEK_DATA lpDataS;
st_asn1_context context;
if( lpReader == NULL || lpReader->lpProtocol == NULL ||
lpReader->lpProtocol->internal == NULL ||
lpReader->lpDevice == NULL || lpTag == NULL ||
lpKeyHMAC == NULL || lpKeyHMAC->lpData == NULL || lpKeyHMAC->lpData->data == NULL || lpKeyHMAC->lpData->size < 1 )
return SKYETEK_INVALID_PARAMETER;
lpDataS = SkyeTek_AllocateData(1024);
if( lpDataS == NULL )
return SKYETEK_OUT_OF_MEMORY;
st_asn1_allocate_context(&context);
st_asn1_init(context, ST_ASN1_ENCODE,lpDataS->data,lpDataS->size);
st_asn1_start_sequence(context);
if( lpKeyHMAC->name != NULL && _tcslen(lpKeyHMAC->name) > 0) {
st_asn1_start_context_specific(context, 1);
st_asn1_write_octet_string(context, (unsigned char *)lpKeyHMAC->name, _tcslen(lpKeyHMAC->name)*sizeof(TCHAR));
st_asn1_finish_context_specific(context, 1);
}
st_asn1_write_octet_string(context, lpKeyHMAC->lpData->data, lpKeyHMAC->lpData->size);
if( lpKeyCipher != NULL && lpKeyCipher->lpData != NULL && lpKeyCipher->lpData->data != NULL && lpKeyCipher->lpData->size > 0 ) {
if( lpKeyCipher->name != NULL && _tcslen(lpKeyCipher->name) > 0) {
st_asn1_start_context_specific(context, 2);
st_asn1_write_octet_string(context, (unsigned char *)lpKeyCipher->name, _tcslen(lpKeyCipher->name)*sizeof(TCHAR));
st_asn1_finish_context_specific(context, 2);
}
st_asn1_write_octet_string(context, lpKeyCipher->lpData->data, lpKeyCipher->lpData->size);
}
if (useKeyDerivationFunction)
st_asn1_write_boolean(context, 1);
st_asn1_finish_sequence(context);
lpDataS->size = st_asn1_finalize(context);
st_asn1_free_context(&context);
lppi = (LPPROTOCOLIMPL)lpReader->lpProtocol->internal;
status = lppi->SetupSecureMemoryTag(lpReader,lpTag,lpDataS,10000);
SkyeTek_FreeData(lpDataS);
return status;
}