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..29898705f3b62fced2fb1ba89dc3cbcb971f7294 |
--- /dev/null |
+++ b/components/gcm_driver/crypto/encryption_header_parsers.h |
@@ -0,0 +1,43 @@ |
+// 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> |
+ |
+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, the rs will be validated. |
+// |
+// https://tools.ietf.org/html/draft-thomson-http-encryption-01#section-3 |
+// |
+// Returns whether the |input| was successfully be parsed, and the resulting |
+// information was stored in |keyid|, |salt| and |rs|. The output arguments will |
+// not be changed unless parsing was successful. |
+bool ParseEncryptionHeader(const std::string& input, |
+ std::string* keyid, |
+ std::string* salt, |
+ int64_t* rs); |
eroman
2015/09/25 18:18:19
uint64_t, since |rs| must be non-negative (in fact
Peter Beverloo
2015/09/28 11:27:15
Done.
|
+ |
+// 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. |
+// |
+// https://tools.ietf.org/html/draft-thomson-http-encryption-01#section-4 |
+// |
+// Returns whether |input| was successfully parsed, and the resulting |
+// information was stored in |keyid|, |key| and |dh|. The output arguments will |
+// not be changed unless parsing was successful. |
+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_ |