OLD | NEW |
1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #ifndef NET_CERT_INTERNAL_EXTENDED_KEY_USAGE_H_ | 5 #ifndef NET_CERT_INTERNAL_EXTENDED_KEY_USAGE_H_ |
6 #define NET_CERT_INTERNAL_EXTENDED_KEY_USAGE_H_ | 6 #define NET_CERT_INTERNAL_EXTENDED_KEY_USAGE_H_ |
7 | 7 |
8 #include <vector> | 8 #include <vector> |
9 | 9 |
| 10 #include "net/base/net_export.h" |
10 #include "net/der/input.h" | 11 #include "net/der/input.h" |
11 | 12 |
12 namespace net { | 13 namespace net { |
13 | 14 |
14 // The following set of methods return the DER-encoded OID, without tag or | 15 // The following set of methods return the DER-encoded OID, without tag or |
15 // length, of the extended key usage purposes defined in RFC 5280 section | 16 // length, of the extended key usage purposes defined in RFC 5280 section |
16 // 4.2.1.12. | 17 // 4.2.1.12. |
17 NET_EXPORT const der::Input AnyEKU(); | 18 NET_EXPORT const der::Input AnyEKU(); |
18 NET_EXPORT const der::Input ServerAuth(); | 19 NET_EXPORT const der::Input ServerAuth(); |
19 NET_EXPORT const der::Input ClientAuth(); | 20 NET_EXPORT const der::Input ClientAuth(); |
20 NET_EXPORT const der::Input CodeSigning(); | 21 NET_EXPORT const der::Input CodeSigning(); |
21 NET_EXPORT const der::Input EmailProtection(); | 22 NET_EXPORT const der::Input EmailProtection(); |
22 NET_EXPORT const der::Input TimeStamping(); | 23 NET_EXPORT const der::Input TimeStamping(); |
23 NET_EXPORT const der::Input OCSPSigning(); | 24 NET_EXPORT const der::Input OCSPSigning(); |
24 | 25 |
25 // Parses |extension_value|, which contains the extnValue field of an X.509v3 | 26 // Parses |extension_value|, which contains the extnValue field of an X.509v3 |
26 // Extended Key Usage extension, and populates |eku_oids| with the list of | 27 // Extended Key Usage extension, and populates |eku_oids| with the list of |
27 // DER-encoded OID values (that is, without tag and length). Returns false if | 28 // DER-encoded OID values (that is, without tag and length). Returns false if |
28 // |extension_value| is improperly encoded. | 29 // |extension_value| is improperly encoded. |
29 // | 30 // |
30 // Note: The returned OIDs are only as valid as long as the data pointed to by | 31 // Note: The returned OIDs are only as valid as long as the data pointed to by |
31 // |extension_value| is valid. | 32 // |extension_value| is valid. |
32 NET_EXPORT bool ParseEKUExtension(const der::Input& extension_value, | 33 NET_EXPORT bool ParseEKUExtension(const der::Input& extension_value, |
33 std::vector<der::Input>* eku_oids); | 34 std::vector<der::Input>* eku_oids); |
34 | 35 |
35 } // namespace net | 36 } // namespace net |
36 | 37 |
37 #endif // NET_CERT_INTERNAL_EXTENDED_KEY_USAGE_H_ | 38 #endif // NET_CERT_INTERNAL_EXTENDED_KEY_USAGE_H_ |
OLD | NEW |