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

Unified Diff: components/gcm_driver/crypto/encryption_header_parsers_unittest.cc

Issue 2106333003: Disallow identical names for the Encryption and Crypto-Key headers (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@headers-changes
Patch Set: spell value properly Created 4 years, 6 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/encryption_header_parsers.cc ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: components/gcm_driver/crypto/encryption_header_parsers_unittest.cc
diff --git a/components/gcm_driver/crypto/encryption_header_parsers_unittest.cc b/components/gcm_driver/crypto/encryption_header_parsers_unittest.cc
index 9afac81d92fda0aad6bf29beb52425f8e5532897..b7142cee2a224262dcff56a36f150e8d7bef8f97 100644
--- a/components/gcm_driver/crypto/encryption_header_parsers_unittest.cc
+++ b/components/gcm_driver/crypto/encryption_header_parsers_unittest.cc
@@ -42,7 +42,6 @@ TEST(EncryptionHeaderParsersTest, ParseValidEncryptionHeaders) {
"", "sixteencoolbytes", kDefaultRecordSize },
{ "rs=2048", "", "", 2048 },
{ "keyid=foo;someothervalue=1;rs=42", "foo", "", 42 },
- { "keyid=foo;keyid=bar", "bar", "", kDefaultRecordSize },
};
for (size_t i = 0; i < arraysize(expected_results); i++) {
@@ -116,6 +115,10 @@ TEST(EncryptionHeaderParsersTest, ParseInvalidEncryptionHeaders) {
"rs",
"rs=",
+ // Supplying the same name multiple times in the same value is invalid.
+ "keyid=foo;keyid=bar",
+ "keyid=foo;bar=baz;keyid=qux",
+
// The salt must be a URL-safe base64 decodable string.
"salt=YmV/2ZXJ-sMDA",
"salt=dHdlbHZlY29vbGJ5dGVz=====",
@@ -187,7 +190,6 @@ TEST(EncryptionHeaderParsersTest, ParseValidCryptoKeyHeaders) {
{ "dh=dHdlbHZlY29vbGJ5dGVz", "", "", "twelvecoolbytes" },
{ "keyid=foo;someothervalue=bar;aesgcm128=dHdlbHZlY29vbGJ5dGVz",
"foo", "twelvecoolbytes", "" },
- { "keyid=foo;keyid=bar", "bar", "", "" },
};
for (size_t i = 0; i < arraysize(expected_results); i++) {
@@ -262,6 +264,10 @@ TEST(EncryptionHeaderParsersTest, ParseInvalidCryptoKeyHeaders) {
"dh",
"dh=",
+ // Supplying the same name multiple times in the same value is invalid.
+ "keyid=foo;keyid=bar",
+ "keyid=foo;bar=baz;keyid=qux",
+
// The "aesgcm128" parameter must be a URL-safe base64 decodable string.
"aesgcm128=123$xyz",
"aesgcm128=foobar;aesgcm128=123$xyz",
« no previous file with comments | « components/gcm_driver/crypto/encryption_header_parsers.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698