18 #ifdef USE_CERTIFICATES
49 REVOCATION_INFO *currentRevocation;
69 VALIDITY_INFO *currentValidity = certInfoPtr->cCertVal->currentValidity;
71 if( currentValidity == NULL )
81 currentRevocation = certInfoPtr->cCertRev->currentRevocation;
82 if( currentRevocation == NULL )
86 if( attributePtr == NULL && \
99 return( attributePtr );
108 static
int getCertAttributeComponent(
const CERT_INFO *certInfoPtr,
125 attributePtr = findAttributeComponent( certInfoPtr, certInfoType );
126 if( attributePtr == NULL )
135 if( checkAttributeProperty( attributePtr,
140 return( defaultValue );
142 *value = defaultValue;
150 if( checkAttributeProperty( attributePtr,
158 return( getAttributeDataValue( attributePtr, value ) );
174 static
int getCertCopy(
const CERT_INFO *certInfoPtr,
182 BYTE certData[ 2048 + 8 ], *certDataPtr = certData;
200 if( msgData.
length > 2048 )
202 if( ( certDataPtr =
clAlloc(
"getCertCopy", \
203 msgData.
length + 8 ) ) == NULL )
217 CRYPT_ICERTTYPE_DATAONLY : \
225 if( certDataPtr != certData )
226 clFree(
"getCertCopy", certDataPtr );
247 assert(
isWritePtr( certInfo,
sizeof(
int ) ) );
268 status = selectGeneralName( certInfoPtr, certInfoType,
280 if( ( certInfoType >= CRYPT_CERTINFO_FIRST_EXTENSION && \
281 certInfoType <= CRYPT_CERTINFO_LAST_EXTENSION ) || \
282 ( certInfoType >= CRYPT_CERTINFO_FIRST_CMS && \
283 certInfoType <= CRYPT_CERTINFO_LAST_CMS ) )
285 return( getCertAttributeComponent( certInfoPtr, certInfoType,
290 switch( certInfoType )
298 *certInfo = ( certInfoPtr->certificate != NULL ) ?
TRUE:
FALSE;
309 if( attributePtr != NULL )
314 status = getAttributeDataPtr( attributePtr, &policyOidPtr,
332 *certInfo = certInfoPtr->type;
348 if( certInfoPtr->attributeCursor == NULL )
351 &certInfoPtr->currentSelection;
353 switch( certInfoType )
361 if( currentSelection->
dnPtr == &certInfoPtr->subjectName )
366 if( currentSelection->
dnPtr == &certInfoPtr->issuerName )
393 switch( certInfoType )
396 status = getAttributeIdInfo( certInfoPtr->attributeCursor,
397 &infoID, NULL, NULL );
402 status = getAttributeIdInfo( certInfoPtr->attributeCursor,
403 NULL, &infoID, NULL );
407 status = getAttributeIdInfo( certInfoPtr->attributeCursor,
408 NULL, NULL, &infoID );
410 status = getAttributeIdInfo( certInfoPtr->attributeCursor,
411 NULL, &infoID, NULL );
423 if( certInfoPtr->cCertCert->trustedUsage ==
CRYPT_ERROR )
425 *certInfo = certInfoPtr->cCertCert->trustedUsage;
431 &certInfoPtr->objectHandle,
438 *certInfo = certInfoPtr->cCertRev->signatureLevel;
443 *certInfo = certInfoPtr->version;
451 certInfoPtr->issuerName : certInfoPtr->subjectName;
465 const CERT_VAL_INFO *certValInfo = certInfoPtr->cCertVal;
466 const VALIDITY_INFO *valInfoPtr = \
467 ( certValInfo->currentValidity != NULL ) ? \
468 certValInfo->currentValidity : certValInfo->validityInfo;
470 if( valInfoPtr == NULL )
472 *certInfo = valInfoPtr->extStatus;
480 const CERT_REV_INFO *certRevInfo = certInfoPtr->cCertRev;
481 const REVOCATION_INFO *revInfoPtr = \
482 ( certRevInfo->currentRevocation != NULL ) ? \
483 certRevInfo->currentRevocation : certRevInfo->revocations;
485 if( revInfoPtr == NULL )
487 *certInfo = revInfoPtr->status;
492 case CRYPT_IATTRIBUTE_CERTKEYALGO:
493 *certInfo = certInfoPtr->publicKeyAlgo;
496 case CRYPT_IATTRIBUTE_CERTHASHALGO:
497 *certInfo = certInfoPtr->cCertCert->hashAlgo;
500 case CRYPT_IATTRIBUTE_CERTCOPY:
504 status = getCertCopy( certInfoPtr, &certCopy,
FALSE );
507 *certInfo = certCopy;
510 case CRYPT_IATTRIBUTE_CERTCOPY_DATAONLY:
514 status = getCertCopy( certInfoPtr, &certCopy,
TRUE );
517 *certInfo = certCopy;