Merge Chromium + Blink git repositories
[chromium-blink-merge.git] / net / cert / internal / extended_key_usage.h
blob9e8812a38a05b1c28bbe114b2b841e7ab0b6928c
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
3 // found in the LICENSE file.
5 #ifndef NET_CERT_INTERNAL_EXTENDED_KEY_USAGE_H_
6 #define NET_CERT_INTERNAL_EXTENDED_KEY_USAGE_H_
8 #include <vector>
10 #include "net/der/input.h"
12 namespace net {
14 // 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 // 4.2.1.12.
17 NET_EXPORT const der::Input AnyEKU();
18 NET_EXPORT const der::Input ServerAuth();
19 NET_EXPORT const der::Input ClientAuth();
20 NET_EXPORT const der::Input CodeSigning();
21 NET_EXPORT const der::Input EmailProtection();
22 NET_EXPORT const der::Input TimeStamping();
23 NET_EXPORT const der::Input OCSPSigning();
25 // 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 // DER-encoded OID values (that is, without tag and length). Returns false if
28 // |extension_value| is improperly encoded.
30 // Note: The returned OIDs are only as valid as long as the data pointed to by
31 // |extension_value| is valid.
32 NET_EXPORT bool ParseEKUExtension(const der::Input& extension_value,
33 std::vector<der::Input>* eku_oids);
35 } // namespace net
37 #endif // NET_CERT_INTERNAL_EXTENDED_KEY_USAGE_H_