Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(202)

Unified Diff: net/cert/x509_certificate_win.cc

Issue 1988993002: Check self-signed certificate names and signatures (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Remove dependency on openssl -text format Created 4 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « net/cert/x509_certificate_unittest.cc ('k') | net/data/ssl/certificates/README » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: net/cert/x509_certificate_win.cc
diff --git a/net/cert/x509_certificate_win.cc b/net/cert/x509_certificate_win.cc
index 7d8e531b1bd839e59727984690ce248ad2eb5c70..6edf6a96c704574f35222fa782f6de467c1f5fe8 100644
--- a/net/cert/x509_certificate_win.cc
+++ b/net/cert/x509_certificate_win.cc
@@ -464,15 +464,16 @@ bool X509Certificate::IsIssuedByEncoded(
// static
bool X509Certificate::IsSelfSigned(OSCertHandle cert_handle) {
- return !!CryptVerifyCertificateSignatureEx(
- NULL,
- X509_ASN_ENCODING,
- CRYPT_VERIFY_CERT_SIGN_SUBJECT_CERT,
+ bool valid_signature = !!CryptVerifyCertificateSignatureEx(
+ NULL, X509_ASN_ENCODING, CRYPT_VERIFY_CERT_SIGN_SUBJECT_CERT,
reinterpret_cast<void*>(const_cast<PCERT_CONTEXT>(cert_handle)),
CRYPT_VERIFY_CERT_SIGN_ISSUER_CERT,
- reinterpret_cast<void*>(const_cast<PCERT_CONTEXT>(cert_handle)),
- 0,
- NULL);
+ reinterpret_cast<void*>(const_cast<PCERT_CONTEXT>(cert_handle)), 0, NULL);
+ if (!valid_signature)
+ return false;
+ return !!CertCompareCertificateName(X509_ASN_ENCODING,
+ &cert_handle->pCertInfo->Subject,
+ &cert_handle->pCertInfo->Issuer);
}
} // namespace net
« no previous file with comments | « net/cert/x509_certificate_unittest.cc ('k') | net/data/ssl/certificates/README » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698