Chromium Code Reviews| Index: components/gcm_driver/crypto/encryption_header_parsers.h |
| diff --git a/components/gcm_driver/crypto/encryption_header_parsers.h b/components/gcm_driver/crypto/encryption_header_parsers.h |
| new file mode 100644 |
| index 0000000000000000000000000000000000000000..9ba06ea5c253bf17bb7978b595132d165bd9d2ca |
| --- /dev/null |
| +++ b/components/gcm_driver/crypto/encryption_header_parsers.h |
| @@ -0,0 +1,54 @@ |
| +// Copyright 2015 The Chromium Authors. All rights reserved. |
| +// Use of this source code is governed by a BSD-style license that can be |
| +// found in the LICENSE file. |
| + |
| +#ifndef COMPONENTS_GCM_DRIVER_CRYPTO_ENCRYPTION_HEADER_PARSERS_H_ |
| +#define COMPONENTS_GCM_DRIVER_CRYPTO_ENCRYPTION_HEADER_PARSERS_H_ |
| + |
| +#include <stdint.h> |
| +#include <string> |
| +#include <vector> |
| + |
| +namespace gcm { |
| + |
| +// Structure representing the parsed values from the Encryption HTTP header. |
| +// |salt| is stored after having been base64url decoded. |
| +struct EncryptionHeaderValues { |
| + std::string keyid; |
| + std::string salt; |
| + uint64_t rs; |
| +}; |
| + |
| +// Parses |input| following the syntax of the Encryption HTTP header. The parsed |
| +// values will be stored in the |*values| argument. |
| +// |
| +// https://tools.ietf.org/html/draft-thomson-http-encryption-01#section-3 |
| +// |
| +// Returns whether the |input| could be successfully parsed, and the resulting |
| +// values are now available in the |*values| argument. Does not modify |*values| |
| +// unless parsing was successful. |
| +bool ParseEncryptionHeader(const std::string& input, |
| + std::vector<EncryptionHeaderValues>* values); |
| + |
| +// Structure representing the parsed values from the Encryption-Key HTTP header. |
| +// |key| and |dh| are stored after having been base64url decoded. |
| +struct EncryptionKeyHeaderValues { |
| + std::string keyid; |
| + std::string key; |
| + std::string dh; |
| +}; |
| + |
| +// Parses |input| following the syntax of the Encryption-Key HTTP header. The |
| +// parsed values will be stored in the |*values| argument. |
| +// |
| +// https://tools.ietf.org/html/draft-thomson-http-encryption-01#section-4 |
| +// |
| +// Returns whether the |input| could be successfully parsed, and the resulting |
| +// values are now available in the |*values| argument. Does not modify |*values| |
| +// unless parsing was successful. |
| +bool ParseEncryptionKeyHeader(const std::string& input, |
| + 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
|
| + |
| +} // namespace gcm |
| + |
| +#endif // COMPONENTS_GCM_DRIVER_CRYPTO_ENCRYPTION_HEADER_PARSERS_H_ |