Index: net/base/x509_certificate_nss_util.h |
diff --git a/net/base/x509_certificate_nss_util.h b/net/base/x509_certificate_nss_util.h |
new file mode 100644 |
index 0000000000000000000000000000000000000000..a4aa3b76ac3951ceb63615deb8b1f2850d90a69e |
--- /dev/null |
+++ b/net/base/x509_certificate_nss_util.h |
@@ -0,0 +1,61 @@ |
+// Copyright (c) 2012 The Chromium Authors. All rights reserved. |
+// Use of this source code is governed by a BSD-style license that can be |
+// found in the LICENSE file. |
+ |
+#ifndef NET_BASE_X509_CERTIFICATE_NSS_UTIL_H_ |
+#define NET_BASE_X509_CERTIFICATE_NSS_UTIL_H_ |
+ |
+#include <cert.h> |
+#include <string> |
+#include <vector> |
+ |
+#include "net/base/x509_certificate.h" |
+ |
+namespace base { |
+class Time; |
+} |
+ |
+class PickleIterator; |
+ |
+namespace net { |
+namespace x509_certificate_nss_util { |
+ |
+// Parses the Principal attribute from |name| and outputs the result in |
+// |principal|. |
+void ParsePrincipal(CERTName* name, |
+ CertPrincipal* principal); |
+ |
+// Parses the date from |der_date| and outputs the result in |result|. |
+void ParseDate(const SECItem* der_date, base::Time* result); |
+ |
+// Parses the serial number from |certificate|. |
+std::string ParseSerialNumber(const CERTCertificate* certificate); |
+ |
+// Gets the subjectAltName extension field from the certificate, if any. |
+void GetSubjectAltName(CERTCertificate* cert_handle, |
+ std::vector<std::string>* dns_names, |
+ std::vector<std::string>* ip_addrs); |
+ |
+// Creates all possible OS certificate handles from |data| encoded in a specific |
+// |format|. Returns an empty collection on failure. |
+X509Certificate::OSCertHandles CreateOSCertHandlesFromBytes( |
+ const char* data, |
+ int length, |
+ X509Certificate::Format format); |
+ |
+// Reads a single certificate from |pickle_iter| and returns a platform-specific |
+// certificate handle. Returns an invalid handle, NULL, on failure. |
+X509Certificate::OSCertHandle ReadOSCertHandleFromPickle( |
+ PickleIterator* pickle_iter); |
+ |
+// Sets |*size_bits| to be the length of the public key in bits, and sets |
+// |*type| to one of the |PublicKeyType| values. In case of |
+// |kPublicKeyTypeUnknown|, |*size_bits| will be set to 0. |
+void GetPublicKeyInfo(CERTCertificate* handle, |
+ size_t* size_bits, |
+ X509Certificate::PublicKeyType* type); |
+ |
+} // namespace x509_certificate_nss_util |
+} // namespace net |
+ |
+#endif // NET_BASE_X509_CERTIFICATE_NSS_UTIL_H_ |