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, |
| 39 std::vector<EncryptionKeyHeaderValue>* result); |
| 40 |
| 41 } // namespace gcm |
| 42 |
| 43 #endif // COMPONENTS_GCM_DRIVER_CRYPTO_ENCRYPTION_HEADER_PARSERS_H_ |
OLD | NEW |