roll skia to 4276
[chromium-blink-merge.git] / net / base / x509_util_openssl.h
blobfbe6336e5ead8c7e42ce7bd51e14bb020df56549
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
5 #ifndef NET_BASE_X509_UTIL_OPENSSL_H_
6 #define NET_BASE_X509_UTIL_OPENSSL_H_
7 #pragma once
9 #include <openssl/asn1.h>
10 #include <openssl/x509v3.h>
12 #include <string>
13 #include <vector>
15 #include "net/base/net_export.h"
17 namespace base {
18 class Time;
19 } // namespace base
21 namespace net {
23 // A collection of helper functions to fetch data from OpenSSL X509 certificates
24 // into more convenient std / base datatypes.
25 namespace x509_util {
27 bool NET_EXPORT ParsePrincipalKeyAndValueByIndex(X509_NAME* name,
28 int index,
29 std::string* key,
30 std::string* value);
32 bool NET_EXPORT ParsePrincipalValueByIndex(X509_NAME* name,
33 int index,
34 std::string* value);
36 bool NET_EXPORT ParsePrincipalValueByNID(X509_NAME* name,
37 int nid,
38 std::string* value);
40 bool NET_EXPORT ParseDate(ASN1_TIME* x509_time, base::Time* time);
42 } // namespace x509_util
44 } // namespace net
46 #endif // NET_BASE_X509_UTIL_OPENSSL_H_