16 #ifdef USE_CERTIFICATES
24 #if defined( USE_CERTREV ) || defined( USE_CERTVAL )
32 static
int generateCertID(
IN_BUFFER( dnLength )
const void *dn,
35 const void *serialNumber,
48 assert(
isReadPtr( serialNumber, serialNumberLength ) && \
49 serialNumberLength > 0 && \
53 REQUIRES( serialNumberLength > 0 && \
58 memset( certID, 0,
min( 16, certIdLength ) );
61 getHashAtomicParameters(
CRYPT_ALGO_SHA1, 0, &hashFunctionAtomic, NULL );
72 status = writeSequence( &stream,
74 serialNumberLength ) );
80 hashFunction( hashInfo, NULL, 0, buffer, stell( &stream ),
84 status = writeInteger( &stream, serialNumber, serialNumberLength,
103 #if defined( USE_CERTREV ) || defined( USE_CERTVAL )
120 &sessionType, CRYPT_IATTRIBUTE_SUBTYPE );
166 int revocationStatus;
198 status = generateCertID( certInfoPtr->issuerDNptr,
199 certInfoPtr->issuerDNsize,
200 certInfoPtr->cCertCert->serialNumber,
201 certInfoPtr->cCertCert->serialNumberLength,
259 assert( issuerCertInfoPtr == NULL || \
261 assert( formatInfo == NULL || \
274 status = checkCertBasic( subjectCertInfoPtr );
282 if( issuerCertInfoPtr != NULL )
284 status = checkCert( subjectCertInfoPtr, issuerCertInfoPtr,
285 shortCircuitCheck, errorLocus, errorType );
301 if( trustAnchorCheck && issuerCertInfoPtr != NULL && \
310 if( !shortCircuitCheck )
315 &subjectCertInfoPtr->objectHandle,
323 status = checkX509signature( subjectCertInfoPtr->certificate,
324 subjectCertInfoPtr->certificateSize,
325 iIssuerPubKey, formatInfo );
328 #ifdef USE_CERTLEVEL_PKIX_PARTIAL
332 int subjectIDlength, issuerIDlength;
354 #ifdef USE_CERTLEVEL_PKIX_PARTIAL
369 issuerIDlength = msgData.
length;
376 subjectIDlength = msgData.
length;
380 return( ( ( issuerIDlength != subjectIDlength ) || \
381 memcmp( subjectIssuerID, issuerSubjectID, \
382 issuerIDlength ) ) ? \
425 assert( formatInfo == NULL || \
433 status = checkCertBasic( certInfoPtr );
443 iCryptContext = certInfoPtr->iPubkeyContext;
476 (
void ** ) &issuerCertInfoPtr,
481 trustedCertAcquired =
TRUE;
485 status = checkCertDetails( certInfoPtr, issuerCertInfoPtr,
487 &certInfoPtr->errorLocus,
488 &certInfoPtr->errorType );
489 if( trustedCertAcquired )
515 REQUIRES( certInfoPtr->certificate != NULL || \
550 return( checkCertChain( certInfoPtr ) );
553 return( checkSelfSignedCert( certInfoPtr, formatInfoPtr ) );
558 &sigCheckObjectType, CRYPT_IATTRIBUTE_TYPE );
574 switch( sigCheckObjectType )
610 status = checkCertBasic( certInfoPtr );
618 #if defined( USE_CERTREV )
621 return( checkCRL( certInfoPtr, iSigCheckObject ) );
627 #if defined( USE_CERTVAL )
629 return( checkRTCSResponse( certInfoPtr, iSigCheckObject ) );
631 #if defined( USE_CERTREV )
633 return( checkOCSPResponse( certInfoPtr, iSigCheckObject ) );
637 return( checkKeyset( certInfoPtr, iSigCheckObject ) );
642 #if defined( USE_CERTREV ) || defined( USE_CERTVAL )
644 return( checkResponder( certInfoPtr, iSigCheckObject ) );
660 &msgData, CRYPT_IATTRIBUTE_KEYID );
690 return( checkCertChain( certInfoPtr ) );
692 return( checkSelfSignedCert( certInfoPtr, formatInfoPtr ) );
708 (
void ** ) &issuerCertInfoPtr,
712 issuerCertAcquired =
TRUE;
729 (
void ** ) &issuerCertInfoPtr,
733 issuerCertAcquired =
TRUE;
738 status = checkCertDetails( certInfoPtr, issuerCertAcquired ? \
739 issuerCertInfoPtr : NULL,
741 &certInfoPtr->errorLocus,
742 &certInfoPtr->errorType );
743 if( issuerCertAcquired )