Changeset 84380 in vbox for trunk/src/VBox/Runtime/common
- Timestamp:
- May 19, 2020 7:42:11 PM (5 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Runtime/common/crypto/pkcs7-verify.cpp
r84331 r84380 409 409 PCRTCRCERTCTX pSignerCertCtx = NULL; 410 410 PCRTCRX509CERTIFICATE pSignerCert = NULL; 411 RTCRSTORE hSignerCertSrc = hTrustedCerts; 412 if (hSignerCertSrc != NIL_RTCRSTORE) 413 pSignerCertCtx = RTCrStoreCertByIssuerAndSerialNo(hSignerCertSrc, &pSignerInfo->IssuerAndSerialNumber.Name, 411 if (hTrustedCerts != NIL_RTCRSTORE) 412 pSignerCertCtx = RTCrStoreCertByIssuerAndSerialNo(hTrustedCerts, &pSignerInfo->IssuerAndSerialNumber.Name, 414 413 &pSignerInfo->IssuerAndSerialNumber.SerialNumber); 415 if (!pSignerCertCtx) 416 { 417 hSignerCertSrc = hAdditionalCerts; 418 if (hSignerCertSrc != NIL_RTCRSTORE) 419 pSignerCertCtx = RTCrStoreCertByIssuerAndSerialNo(hSignerCertSrc, &pSignerInfo->IssuerAndSerialNumber.Name, 420 &pSignerInfo->IssuerAndSerialNumber.SerialNumber); 421 } 414 if (!pSignerCertCtx && hAdditionalCerts != NIL_RTCRSTORE) 415 pSignerCertCtx = RTCrStoreCertByIssuerAndSerialNo(hAdditionalCerts, &pSignerInfo->IssuerAndSerialNumber.Name, 416 &pSignerInfo->IssuerAndSerialNumber.SerialNumber); 422 417 if (pSignerCertCtx) 423 418 pSignerCert = pSignerCertCtx->pCert; 424 419 else 425 420 { 426 hSignerCertSrc = NULL;427 421 pSignerCert = RTCrPkcs7SetOfCerts_FindX509ByIssuerAndSerialNumber(&pSignedData->Certificates, 428 422 &pSignerInfo->IssuerAndSerialNumber.Name, … … 436 430 437 431 /* 438 * If not a trusted certificate, we'll have to build certificate paths 439 * and verify them. If no valid paths are found, this step will fail. 440 */ 441 int rc = VINF_SUCCESS; 442 if ( /*( hSignerCertSrc == NIL_RTCRSTORE 443 || hSignerCertSrc != hTrustedCerts ) 444 &&*/ /** @todo 'hSignerCertSrc != hTrustedCerts' ain't making sense wrt pValidationTime */ 445 !(fFlags & RTCRPKCS7VERIFY_SD_F_TRUST_ALL_CERTS) ) 432 * Unless caller requesed all certificates to be trusted fully, we always 433 * pass it on to the certificate path builder so it can do the requested 434 * checks on trust anchors. (We didn't used to do this as the path 435 * builder could handle trusted targets. A benefit here is that 436 * pfnVerifyCert can assume a hCertPaths now, and get the validation time 437 * from it if it wants it.) 438 * 439 * If no valid paths are found, this step will fail. 440 */ 441 int rc; 442 if (!(fFlags & RTCRPKCS7VERIFY_SD_F_TRUST_ALL_CERTS)) 446 443 { 447 444 RTCRX509CERTPATHS hCertPaths; … … 456 453 if (pSignedData->Certificates.cItems > 0 && RT_SUCCESS(rc)) 457 454 rc = RTCrX509CertPathsSetUntrustedSet(hCertPaths, &pSignedData->Certificates); 455 if ((fFlags & RTCRPKCS7VERIFY_SD_F_CHECK_TRUST_ANCHORS) && RT_SUCCESS(rc)) 456 rc = RTCrX509CertPathsSetTrustAnchorChecks(hCertPaths, true /*fEnable*/); 458 457 if (RT_SUCCESS(rc)) 459 458 {
Note:
See TracChangeset
for help on using the changeset viewer.