Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(63)

Unified Diff: components/gcm_driver/crypto/encryption_header_parsers.h

Issue 1244803002: Add parsers for the Encryption and Encryption-Key HTTP headers. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « components/gcm_driver/crypto/DEPS ('k') | components/gcm_driver/crypto/encryption_header_parsers.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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..4bf77132c0c0752a801f8cdf678888c7ad718350
--- /dev/null
+++ b/components/gcm_driver/crypto/encryption_header_parsers.h
@@ -0,0 +1,64 @@
+// 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
+//
+// This header follows the #list syntax from the extended ABNF syntax
+// defined in section 1.2 of RFC 7230:
+//
+// https://tools.ietf.org/html/rfc7230#section-1.2
+//
+// 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
+//
+// This header follows the #list syntax from the extended ABNF syntax
+// defined in section 1.2 of RFC 7230:
+//
+// https://tools.ietf.org/html/rfc7230#section-1.2
+//
+// 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);
+
+} // namespace gcm
+
+#endif // COMPONENTS_GCM_DRIVER_CRYPTO_ENCRYPTION_HEADER_PARSERS_H_
« no previous file with comments | « components/gcm_driver/crypto/DEPS ('k') | components/gcm_driver/crypto/encryption_header_parsers.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698