本文整理汇总了C++中PANSC_ASN1_CERTIFICATE::IsSelfSigned方法的典型用法代码示例。如果您正苦于以下问题:C++ PANSC_ASN1_CERTIFICATE::IsSelfSigned方法的具体用法?C++ PANSC_ASN1_CERTIFICATE::IsSelfSigned怎么用?C++ PANSC_ASN1_CERTIFICATE::IsSelfSigned使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类PANSC_ASN1_CERTIFICATE
的用法示例。
在下文中一共展示了PANSC_ASN1_CERTIFICATE::IsSelfSigned方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: anscFreeCertHandle
BOOL
AnscX509CertIsSelfSigned
(
void* raw_cert_data,
ULONG raw_cert_size
)
{
PANSC_ASN1_CERTIFICATE pAsnCert = NULL;
BOOL bIsSelfSigned = FALSE;
/* decode the asn.1 certificate handle */
pAsnCert = (PANSC_ASN1_CERTIFICATE)
anscGetCertHandle
(
raw_cert_data,
raw_cert_size
);
if( pAsnCert == NULL)
{
goto EXIT;
}
bIsSelfSigned = pAsnCert->IsSelfSigned(pAsnCert);
EXIT:
anscFreeCertHandle((ANSC_HANDLE)pAsnCert);
return bIsSelfSigned;
}
示例2: if
/*********************************************************************************
*
* Utility functions
*
*********************************************************************************/
ANSC_X509_CERTIFICATE*
AnscX509CertGetCertWrap
(
void* raw_cert_data,
ULONG raw_cert_size
)
{
ANSC_X509_CERTIFICATE* pX509Cert = NULL;
PANSC_ASN1_CERTIFICATE pAsnCert = NULL;
ULONG keyUsage = 0;
ANSC_CRYPTO_HASH hash;
/* decode the asn.1 certificate handle */
pAsnCert = (PANSC_ASN1_CERTIFICATE)
anscGetCertHandle
(
raw_cert_data,
raw_cert_size
);
if( pAsnCert == NULL)
{
goto EXIT;
}
/* create the X509 Certificate */
pX509Cert = (PANSC_X509_CERTIFICATE)AnscAllocateMemory(sizeof(ANSC_X509_CERTIFICATE));
if( pX509Cert == NULL)
{
goto EXIT;
}
/* init the pX509Cert */
pX509Cert->CertSize = raw_cert_size;
pX509Cert->CertData = (PVOID)AnscAllocateMemory(raw_cert_size);
if( pX509Cert->CertData != NULL)
{
AnscCopyMemory( pX509Cert->CertData, raw_cert_data, raw_cert_size);
}
pX509Cert->bSelfSigned = pAsnCert->IsSelfSigned(pAsnCert);
if( pAsnCert->GetKeyType(pAsnCert) == PKI_RSA_KEY)
{
pX509Cert->Signing = ANSC_CERT_signing_rsa;
pX509Cert->KeyType = ANSC_CERT_keyType_rsa;
}
else if( pAsnCert->GetKeyType(pAsnCert) == PKI_DSA_KEY)
{
pX509Cert->Signing = ANSC_CERT_signing_dsa;
pX509Cert->KeyType = ANSC_CERT_keyType_dsa;
}
else
{
pX509Cert->KeyType = ANSC_CERT_keyType_diffieHellman;
}
/* get the key length */
pX509Cert->KeyBits = pAsnCert->GetKeyBits(pAsnCert);
/* get the key usage; */
if( ANSC_STATUS_SUCCESS == pAsnCert->GetKeyUsage(pAsnCert, &keyUsage))
{
/* the value has to be reversed */
pX509Cert->KeyUsage = 0;
if( keyUsage >= 0x0100)
{
pX509Cert->KeyUsage += ANSC_CERT_keyUsage_deciperOnly;
}
keyUsage = keyUsage & 0x000000FF;
if( keyUsage & 0x00000001)
{
pX509Cert->KeyUsage += 0x000000080;
}
if( keyUsage & 0x00000002)
{
pX509Cert->KeyUsage += 0x000000040;
}
if( keyUsage & 0x00000004)
{
pX509Cert->KeyUsage += 0x000000020;
}
if( keyUsage & 0x00000008)
{
pX509Cert->KeyUsage += 0x000000010;
}
if( keyUsage & 0x00000010)
{
pX509Cert->KeyUsage += 0x000000008;
}
//.........这里部分代码省略.........