diff options
author | ukai@chromium.org <ukai@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-06-23 06:35:05 +0000 |
---|---|---|
committer | ukai@chromium.org <ukai@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-06-23 06:35:05 +0000 |
commit | f6555adcd5160d011ea1dc613fa0387dcddd0b6b (patch) | |
tree | 4020b1afb10822b10da786a4ef8f8522c7e9b0d2 /net/base/x509_certificate_win.cc | |
parent | 36a784c511d467509d9a70a76b0865f60380ec37 (diff) | |
download | chromium_src-f6555adcd5160d011ea1dc613fa0387dcddd0b6b.zip chromium_src-f6555adcd5160d011ea1dc613fa0387dcddd0b6b.tar.gz chromium_src-f6555adcd5160d011ea1dc613fa0387dcddd0b6b.tar.bz2 |
Use LOAD_VERIFY_EV_CERT to verify EV-ness in Verify().
If LOAD_VERIFY_EV_CERT is requested on load_flags
and revokation checking is performed, Verify() peforms
EV certificate verification as well, and sets
CERT_STATUS_IS_EV in verify_result.
Eliminate X509Certificate::IsEV()
BUG=3592
TEST=net_unittests with ALLOW_EXTERNAL_ACCESS=1, \
visit https://www.thawte.com/ and shows EV info.
Review URL: http://codereview.chromium.org/125120
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@19011 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'net/base/x509_certificate_win.cc')
-rw-r--r-- | net/base/x509_certificate_win.cc | 32 |
1 files changed, 16 insertions, 16 deletions
diff --git a/net/base/x509_certificate_win.cc b/net/base/x509_certificate_win.cc index bae5607..ece65be 100644 --- a/net/base/x509_certificate_win.cc +++ b/net/base/x509_certificate_win.cc @@ -428,7 +428,7 @@ void X509Certificate::GetDNSNames(std::vector<std::string>* dns_names) const { } int X509Certificate::Verify(const std::string& hostname, - bool rev_checking_enabled, + int flags, CertVerifyResult* verify_result) const { verify_result->Reset(); @@ -443,12 +443,14 @@ int X509Certificate::Verify(const std::string& hostname, chain_para.RequestedUsage.Usage.cUsageIdentifier = 0; chain_para.RequestedUsage.Usage.rgpszUsageIdentifier = NULL; // LPSTR* // We can set CERT_CHAIN_RETURN_LOWER_QUALITY_CONTEXTS to get more chains. - DWORD flags = CERT_CHAIN_CACHE_END_CERT; - if (rev_checking_enabled) { + DWORD chain_flags = CERT_CHAIN_CACHE_END_CERT; + if (flags & VERIFY_REV_CHECKING_ENABLED) { verify_result->cert_status |= CERT_STATUS_REV_CHECKING_ENABLED; - flags |= CERT_CHAIN_REVOCATION_CHECK_CHAIN_EXCLUDE_ROOT; + chain_flags |= CERT_CHAIN_REVOCATION_CHECK_CHAIN_EXCLUDE_ROOT; } else { - flags |= CERT_CHAIN_REVOCATION_CHECK_CACHE_ONLY; + chain_flags |= CERT_CHAIN_REVOCATION_CHECK_CACHE_ONLY; + // EV requires revocation checking. + flags &= ~VERIFY_EV_CERT; } PCCERT_CHAIN_CONTEXT chain_context; if (!CertGetCertificateChain( @@ -457,7 +459,7 @@ int X509Certificate::Verify(const std::string& hostname, NULL, // current system time cert_handle_->hCertStore, // search this store &chain_para, - flags, + chain_flags, NULL, // reserved &chain_context)) { return MapSecurityError(GetLastError()); @@ -553,22 +555,20 @@ int X509Certificate::Verify(const std::string& hostname, if (IsCertStatusError(verify_result->cert_status)) return MapCertStatusToNetError(verify_result->cert_status); + + // TODO(ukai): combine regular cert verification and EV cert verification. + if ((flags & VERIFY_EV_CERT) && VerifyEV()) + verify_result->cert_status |= CERT_STATUS_IS_EV; return OK; } // Returns true if the certificate is an extended-validation certificate. // -// The certificate has already been verified by the HTTP library. cert_status -// represents the result of that verification. This function performs -// additional checks of the certificatePolicies extensions of the certificates -// in the certificate chain according to Section 7 (pp. 11-12) of the EV -// Certificate Guidelines Version 1.0 at +// This function checks the certificatePolicies extensions of the +// certificates in the certificate chain according to Section 7 (pp. 11-12) +// of the EV Certificate Guidelines Version 1.0 at // http://cabforum.org/EV_Certificate_Guidelines.pdf. -bool X509Certificate::IsEV(int cert_status) const { - if (net::IsCertStatusError(cert_status) || - (cert_status & net::CERT_STATUS_REV_CHECKING_ENABLED) == 0) - return false; - +bool X509Certificate::VerifyEV() const { net::EVRootCAMetadata* metadata = net::EVRootCAMetadata::GetInstance(); PCCERT_CHAIN_CONTEXT chain_context = ConstructCertChain(cert_handle_, |