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

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: rewrite Created 5 years, 3 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
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..7e362c3af2a62b8509258bb96748bfd45423ebbf
--- /dev/null
+++ b/components/gcm_driver/crypto/encryption_header_parsers.h
@@ -0,0 +1,41 @@
+// 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>
whywhat 2015/09/14 14:57:43 can we include <cstdint> ? (.h is much more common
Peter Beverloo 2015/09/15 19:41:11 That just includes stdint.h, except that it also p
+#include <string>
+
+namespace gcm {
+
+// Parses |input| following the syntax of the Encryption HTTP header. Chrome
+// only supports a single set of properties to be read from the header at this
+// time. The base64url encoded salt will be decoded, |rs| will be validated.
whywhat 2015/09/14 14:57:43 s/salt/|salt|? what about |keyid|?
Peter Beverloo 2015/09/15 19:41:11 s/|rs|/rs/ in fact. This part of the comment refer
+//
+// https://tools.ietf.org/html/draft-thomson-http-encryption-01#section-3
+//
+// Returns whether the |input| could successfully be parsed, and the resulting
whywhat 2015/09/14 14:57:43 s/could successfully be parsed/was (or has been) s
Peter Beverloo 2015/09/15 19:41:11 Done.
+// information was stored in |keyid|, |salt| and |rs|.
+bool ParseEncryptionHeader(const std::string& input,
+ std::string* keyid,
+ std::string* salt,
+ int64_t* rs);
+
+// Parses |input| following the syntax of the Encryption-Key HTTP header. Chrome
+// only supports a single set of properties to be read from the header at this
+// time. The base64url encoded key and dh will be decoded.
whywhat 2015/09/14 14:57:43 s/key/|key| and s/dh/|dh|? Mostly to be consistent
Peter Beverloo 2015/09/15 19:41:11 Acknowledged.
+//
+// https://tools.ietf.org/html/draft-thomson-http-encryption-01#section-4
+//
+// Returns whether |input| could be successfully parsed, and the resulting
whywhat 2015/09/14 14:57:43 ditto about the phrasing and the return value
Peter Beverloo 2015/09/15 19:41:11 Done.
+// information was stored in |keyid|, |key| and |dh|.
+bool ParseEncryptionKeyHeader(const std::string& input,
+ std::string* keyid,
+ std::string* key,
+ std::string* dh);
+
+} // namespace gcm
+
+#endif // COMPONENTS_GCM_DRIVER_CRYPTO_ENCRYPTION_HEADER_PARSERS_H_

Powered by Google App Engine
This is Rietveld 408576698