本文整理汇总了C++中PANSC_ASN1_CERTIFICATE::GetKeyUsage方法的典型用法代码示例。如果您正苦于以下问题:C++ PANSC_ASN1_CERTIFICATE::GetKeyUsage方法的具体用法?C++ PANSC_ASN1_CERTIFICATE::GetKeyUsage怎么用?C++ PANSC_ASN1_CERTIFICATE::GetKeyUsage使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类PANSC_ASN1_CERTIFICATE
的用法示例。
在下文中一共展示了PANSC_ASN1_CERTIFICATE::GetKeyUsage方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: if
ULONG
AnscX509CertGetKeyType
(
void* raw_cert_data,
ULONG raw_cert_size,
PULONG cert_signing,
PULONG cert_key_usage,
PULONG cert_key_bits
)
{
PANSC_ASN1_CERTIFICATE pAsnCert = NULL;
ULONG keyType = ANSC_CERT_keyType_rsa;
ULONG keyUsage;
/* decode the asn.1 certificate handle */
pAsnCert = (PANSC_ASN1_CERTIFICATE)
anscGetCertHandle
(
raw_cert_data,
raw_cert_size
);
if( pAsnCert == NULL)
{
goto EXIT;
}
if( pAsnCert->GetKeyType(pAsnCert) == PKI_RSA_KEY)
{
keyType = ANSC_CERT_keyType_rsa;
*cert_signing = ANSC_CERT_signing_rsa;
}
else if( pAsnCert->GetKeyType(pAsnCert) == PKI_DSA_KEY)
{
keyType = ANSC_CERT_keyType_dsa;
*cert_signing = ANSC_CERT_signing_dsa;
}
else
{
keyType = ANSC_CERT_keyType_diffieHellman;
}
*cert_key_bits = pAsnCert->GetKeyBits(pAsnCert);
/* get the key usage; */
if( ANSC_STATUS_SUCCESS == pAsnCert->GetKeyUsage(pAsnCert, &keyUsage))
{
if( keyUsage >= 0x0100)
{
*cert_key_usage |= ANSC_CERT_keyUsage_deciperOnly;
}
*cert_key_usage += keyUsage & 0x000000FF;
}
EXIT:
anscFreeCertHandle((ANSC_HANDLE)pAsnCert);
return keyType;
}