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

Unified Diff: net/base/x509_certificate_nss.cc

Issue 11579002: Add X509Certificate::IsIssuedByEncoded() (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: Add missing base files (damn you git cl upload) Created 8 years 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
Index: net/base/x509_certificate_nss.cc
diff --git a/net/base/x509_certificate_nss.cc b/net/base/x509_certificate_nss.cc
index 54d2197e30ecd2db96f7d008a8c7442080e7a9fd..f0515f53161ad7a84a2a250e25701bd5b67291a7 100644
--- a/net/base/x509_certificate_nss.cc
+++ b/net/base/x509_certificate_nss.cc
@@ -10,6 +10,7 @@
#include <nss.h>
#include <pk11pub.h>
#include <prtime.h>
+#include <seccomon.h>
#include <secder.h>
#include <sechash.h>
@@ -154,6 +155,21 @@ bool X509Certificate::VerifyNameMatch(const std::string& hostname) const {
return CERT_VerifyCertName(cert_handle_, hostname.c_str()) == SECSuccess;
}
+bool X509Certificate::IsIssuedByEncoded(
+ const std::vector<std::string>& valid_issuers) {
+ if (x509_util::IsCertNameItemInIssuerList(&cert_handle_->derIssuer,
+ valid_issuers))
Ryan Sleevi 2012/12/13 19:49:05 STYLE: See comments re braces (also line 166-168)
+ return true;
+
+ for (OSCertHandles::iterator it = intermediate_ca_certs_.begin();
+ it != intermediate_ca_certs_.end(); ++it) {
+ if (x509_util::IsCertNameItemInIssuerList(&(*it)->derSubject,
+ valid_issuers))
Ryan Sleevi 2012/12/13 19:49:05 BUG: See comment in ios re subject vs issuer
+ return true;
+ }
+ return false;
+}
+
// static
bool X509Certificate::GetDEREncoded(X509Certificate::OSCertHandle cert_handle,
std::string* encoded) {

Powered by Google App Engine
This is Rietveld 408576698