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

Unified Diff: net/base/x509_util_ios.h

Issue 10983023: Port certificate verification to iOS. (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: . Created 8 years, 3 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
Index: net/base/x509_util_ios.h
diff --git a/net/base/x509_util_ios.h b/net/base/x509_util_ios.h
index 641ddba136041179919cbef059dcf228db0f8cff..b8aca014d1716e1c6ea74ba14797817161898314 100644
--- a/net/base/x509_util_ios.h
+++ b/net/base/x509_util_ios.h
@@ -9,11 +9,17 @@
#define NET_BASE_X509_UTIL_IOS_H_
#include <Security/Security.h>
+#include <vector>
+
+#include "net/base/x509_cert_types.h"
// Forward declaration; real one in <cert.h>
typedef struct CERTCertificateStr CERTCertificate;
namespace net {
+
+class X509Certificate;
+
namespace x509_util_ios {
// Converts a Security.framework certificate handle (SecCertificateRef) into
@@ -25,6 +31,16 @@ CERTCertificate* CreateNSSCertHandleFromOSHandle(SecCertificateRef cert_handle);
SecCertificateRef CreateOSCertHandleFromNSSHandle(
CERTCertificate* nss_cert_handle);
+// Create a new X509Certificate from the specified NSS server cert and
+// intermediates. This is functionally equivalent to
+// X509Certificate::CreateFromHandle(), except it supports receiving
+// NSS CERTCertificate*s rather than iOS SecCertificateRefs.
+X509Certificate* CreateCertFromNSSHandles(
+ CERTCertificate* cert_handle,
+ const std::vector<CERTCertificate*>& intermediates);
+
+SHA1HashValue CalculateFingerprintNSS(CERTCertificate* cert);
+
// This is a wrapper class around the native NSS certificate handle.
// The constructor copies the certificate data from |cert_handle| and
// uses the NSS library to parse it.
@@ -32,11 +48,23 @@ class NSSCertificate {
public:
explicit NSSCertificate(SecCertificateRef cert_handle);
~NSSCertificate();
- CERTCertificate* cert_handle();
+ CERTCertificate* cert_handle() const;
private:
CERTCertificate* nss_cert_handle_;
};
+// A wrapper class that loads a certificate and all of its intermediates into
+// NSS. This is necessary for libpkix path building to be able to locate
+// needed intermediates.
+class NSSCertChain {
+ public:
+ explicit NSSCertChain(X509Certificate* certificate);
+ ~NSSCertChain();
+ CERTCertificate* cert_handle() const;
+ private:
+ std::vector<CERTCertificate*> certs_;
+};
+
} // namespace x509_util_ios
} // namespace net
« no previous file with comments | « net/base/net_test_suite.cc ('k') | net/base/x509_util_ios.cc » ('j') | net/base/x509_util_ios.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698