Chromium Code Reviews| 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 a parsed and decoded value from the Encryption header. | |
| 15 // https://tools.ietf.org/html/draft-thomson-http-encryption-01#section-3 | |
| 16 struct EncryptionHeaderValue { | |
| 17 std::string keyid; | |
| 18 std::string salt; | |
| 19 int64_t rs = 4096; | |
| 20 }; | |
| 21 | |
| 22 // Structure representing a parsed and decoded value from the Encryption-Key | |
| 23 // header. | |
| 24 // https://tools.ietf.org/html/draft-thomson-http-encryption-01#section-4 | |
| 25 struct EncryptionKeyHeaderValue { | |
| 26 std::string keyid; | |
| 27 std::string key; | |
| 28 std::string dh; | |
| 29 }; | |
| 30 | |
| 31 // Parses |input| following the syntax of the Encryption HTTP header. Returns | |
| 32 // whether the |input| could be parsed into |result| successfully. | |
| 33 bool ParseEncryptionHeader(const std::string& input, | |
| 34 std::vector<EncryptionHeaderValue>* result); | |
| 35 | |
| 36 // Parses |input| following the syntax of the Encryption-Key HTTP header. | |
| 37 // Returns whether the |input| could be parsed into |result| successfully. | |
| 38 bool ParseEncryptionKeyHeader(const std::string& input, | |
|
johnme
2015/07/21 14:34:43
I'm not sure this is the optimal API. Unless I'm m
Peter Beverloo
2015/07/21 17:51:30
My thinking here is that they are two separate hea
| |
| 39 std::vector<EncryptionKeyHeaderValue>* result); | |
| 40 | |
| 41 } // namespace gcm | |
| 42 | |
| 43 #endif // COMPONENTS_GCM_DRIVER_CRYPTO_ENCRYPTION_HEADER_PARSERS_H_ | |
| OLD | NEW |