本文整理汇总了C++中PANSC_ASN1_CERTIFICATE::GetSubjectHandle方法的典型用法代码示例。如果您正苦于以下问题:C++ PANSC_ASN1_CERTIFICATE::GetSubjectHandle方法的具体用法?C++ PANSC_ASN1_CERTIFICATE::GetSubjectHandle怎么用?C++ PANSC_ASN1_CERTIFICATE::GetSubjectHandle使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类PANSC_ASN1_CERTIFICATE
的用法示例。
在下文中一共展示了PANSC_ASN1_CERTIFICATE::GetSubjectHandle方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: anscFreeCertHandle
ANSC_X501_NAME*
AnscX509CertGetSubject
(
void* raw_cert_data,
ULONG raw_cert_size
)
{
ANSC_X501_NAME* pSubjectName = NULL;
PANSC_ASN1_CERTIFICATE pAsnCert = NULL;
PANSC_ASN1_NAME pAsnName = NULL;
PUCHAR pBack = (PUCHAR)raw_cert_data;
ULONG length;
/* decode the asn.1 certificate handle */
pAsnCert = (PANSC_ASN1_CERTIFICATE)
anscGetCertHandle
(
raw_cert_data,
raw_cert_size
);
if( pAsnCert == NULL)
{
goto EXIT;
}
/* get the asn1 subject name object */
pAsnName = (PANSC_ASN1_NAME)pAsnCert->GetSubjectHandle(pAsnCert);
if( pAsnName == NULL || pAsnName->bOptional)
{
goto EXIT;
}
length = pAsnName->GetSizeOfEncoded(pAsnName);
/* create the X501Name object */
pSubjectName = (PANSC_X501_NAME)AnscAllocateMemory(sizeof(ULONG) + length);
if( pSubjectName == NULL)
{
goto EXIT;
}
pSubjectName->Length = length;
pBack = pSubjectName->Data;
pAsnName->EncodingData(pAsnName, (PVOID*)&pBack);
EXIT:
anscFreeCertHandle((ANSC_HANDLE)pAsnCert);
return pSubjectName;
}