summaryrefslogtreecommitdiffstats
path: root/net/base/x509_openssl_util.h
diff options
context:
space:
mode:
authorBen Murdoch <benm@google.com>2010-11-18 18:32:45 +0000
committerBen Murdoch <benm@google.com>2010-11-18 18:38:07 +0000
commit513209b27ff55e2841eac0e4120199c23acce758 (patch)
treeaeba30bb08c5f47c57003544e378a377c297eee6 /net/base/x509_openssl_util.h
parent164f7496de0fbee436b385a79ead9e3cb81a50c1 (diff)
downloadexternal_chromium-513209b27ff55e2841eac0e4120199c23acce758.zip
external_chromium-513209b27ff55e2841eac0e4120199c23acce758.tar.gz
external_chromium-513209b27ff55e2841eac0e4120199c23acce758.tar.bz2
Merge Chromium at r65505: Initial merge by git.
Change-Id: I31d8f1d8cd33caaf7f47ffa7350aef42d5fbdb45
Diffstat (limited to 'net/base/x509_openssl_util.h')
-rw-r--r--net/base/x509_openssl_util.h39
1 files changed, 39 insertions, 0 deletions
diff --git a/net/base/x509_openssl_util.h b/net/base/x509_openssl_util.h
new file mode 100644
index 0000000..5ac511b
--- /dev/null
+++ b/net/base/x509_openssl_util.h
@@ -0,0 +1,39 @@
+// Copyright (c) 2006-2008 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_OPENSSL_UTIL_H_
+#define NET_BASE_X509_OPENSSL_UTIL_H_
+#pragma once
+
+#include <openssl/asn1.h>
+#include <openssl/x509v3.h>
+
+#include <string>
+
+namespace base {
+class Time;
+} // namespace base
+
+namespace net {
+
+// A collection of helper functions to fetch data from OpenSSL X509 certificates
+// into more convenient std / base datatypes.
+namespace x509_openssl_util {
+
+bool ParsePrincipalKeyAndValueByIndex(X509_NAME* name,
+ int index,
+ std::string* key,
+ std::string* value);
+
+bool ParsePrincipalValueByIndex(X509_NAME* name, int index, std::string* value);
+
+bool ParsePrincipalValueByNID(X509_NAME* name, int nid, std::string* value);
+
+bool ParseDate(ASN1_TIME* x509_time, base::Time* time);
+
+} // namespace x509_openssl_util
+
+} // namespace net
+
+#endif // NET_BASE_X509_OPENSSL_UTIL_H_