OLD | NEW |
---|---|
(Empty) | |
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. | |
4 | |
5 #ifndef COMPONENTS_GCM_DRIVER_CRYPTO_ENCRYPTION_HEADER_PARSERS_H_ | |
6 #define COMPONENTS_GCM_DRIVER_CRYPTO_ENCRYPTION_HEADER_PARSERS_H_ | |
7 | |
8 #include <stdint.h> | |
9 #include <string> | |
10 #include <vector> | |
11 | |
12 namespace gcm { | |
13 | |
14 // Structure representing the parsed values from the Encryption HTTP header. | |
15 // |salt| is stored after having been base64url decoded. | |
16 struct EncryptionHeaderValues { | |
17 std::string keyid; | |
18 std::string salt; | |
19 uint64_t rs; | |
20 }; | |
21 | |
22 // Parses |input| following the syntax of the Encryption HTTP header. The parsed | |
23 // values will be stored in the |*values| argument. | |
24 // | |
25 // https://tools.ietf.org/html/draft-thomson-http-encryption-01#section-3 | |
26 // | |
27 // Returns whether the |input| could be successfully parsed, and the resulting | |
28 // values are now available in the |*values| argument. Does not modify |*values| | |
29 // unless parsing was successful. | |
30 bool ParseEncryptionHeader(const std::string& input, | |
31 std::vector<EncryptionHeaderValues>* values); | |
32 | |
33 // Structure representing the parsed values from the Encryption-Key HTTP header. | |
34 // |key| and |dh| are stored after having been base64url decoded. | |
35 struct EncryptionKeyHeaderValues { | |
36 std::string keyid; | |
37 std::string key; | |
38 std::string dh; | |
39 }; | |
40 | |
41 // Parses |input| following the syntax of the Encryption-Key HTTP header. The | |
42 // parsed values will be stored in the |*values| argument. | |
43 // | |
44 // https://tools.ietf.org/html/draft-thomson-http-encryption-01#section-4 | |
45 // | |
46 // Returns whether the |input| could be successfully parsed, and the resulting | |
47 // values are now available in the |*values| argument. Does not modify |*values| | |
48 // unless parsing was successful. | |
49 bool ParseEncryptionKeyHeader(const std::string& input, | |
50 std::vector<EncryptionKeyHeaderValues>* values); | |
Ryan Sleevi
2015/10/01 22:50:45
I know I'm being a pain, but this is still fairly
Peter Beverloo
2015/10/02 13:10:22
You are saying "do it my way" because of consisten
| |
51 | |
52 } // namespace gcm | |
53 | |
54 #endif // COMPONENTS_GCM_DRIVER_CRYPTO_ENCRYPTION_HEADER_PARSERS_H_ | |
OLD | NEW |