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

Unified Diff: net/base/x509_certificate_ios.cc

Issue 11579002: Add X509Certificate::IsIssuedByEncoded() (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: another ios fix 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
« no previous file with comments | « net/base/x509_certificate.h ('k') | net/base/x509_certificate_mac.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: net/base/x509_certificate_ios.cc
diff --git a/net/base/x509_certificate_ios.cc b/net/base/x509_certificate_ios.cc
index 0286203ebb41aa255278c2ca85e87e8c38325707..4d0188fdf0d640f5564d466bb99eb1dda6d31aee 100644
--- a/net/base/x509_certificate_ios.cc
+++ b/net/base/x509_certificate_ios.cc
@@ -69,6 +69,21 @@ void X509Certificate::Initialize() {
ca_fingerprint_ = CalculateCAFingerprint(intermediate_ca_certs_);
}
+bool X509Certificate::IsIssuedByEncoded(
+ const std::vector<std::string>& valid_issuers) {
+ x509_util_ios::NSSCertChain nss_chain(this);
+ // Convert to scoped CERTName* list.
droger 2012/12/19 12:26:23 Optional nit: you could consider sharing more code
digit1 2012/12/19 12:58:42 That's what I tried originally in a previous patch
+ std::vector<CERTName*> issuers;
+ crypto::ScopedPLArenaPool arena(PORT_NewArena(DER_DEFAULT_CHUNKSIZE));
+ if (!x509_util::GetIssuersFromEncodedList(
+ valid_issuers, arena.get(), &issuers))
+ return false;
droger 2012/12/19 12:26:23 Nit: I think you need curly braces for multi-line
digit1 2012/12/19 12:58:42 Thanks, I've fixed this in the latest patch.
+
+ // Do the comparison.
+ return x509_util::IsCertificateIssuedBy(
+ nss_chain.cert_chain(), issuers);
+}
+
// static
X509Certificate* X509Certificate::CreateSelfSigned(
crypto::RSAPrivateKey* key,
« no previous file with comments | « net/base/x509_certificate.h ('k') | net/base/x509_certificate_mac.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698