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

Unified Diff: content/child/webcrypto/webcrypto_util.cc

Issue 294393009: [webcrypto] Order jwk_ops the same way as Key.usages. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Add a comment 'splaining to keep it sorted Created 6 years, 7 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 | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: content/child/webcrypto/webcrypto_util.cc
diff --git a/content/child/webcrypto/webcrypto_util.cc b/content/child/webcrypto/webcrypto_util.cc
index e3433fdfc1da0cc95dcad94d365e904ea3f2194a..a46961c4e9699ebe6618f5c3ba7413d482f7253f 100644
--- a/content/child/webcrypto/webcrypto_util.cc
+++ b/content/child/webcrypto/webcrypto_util.cc
@@ -63,15 +63,22 @@ struct JwkToWebCryptoUsage {
const blink::WebCryptoKeyUsage webcrypto_usage;
};
+// Keep this ordered according to the definition
+// order of WebCrypto's "recognized key usage
+// values".
+//
+// This is not required for spec compliance,
+// however it makes the ordering of key_ops match
+// that of WebCrypto's Key.usages.
const JwkToWebCryptoUsage kJwkWebCryptoUsageMap[] = {
{"encrypt", blink::WebCryptoKeyUsageEncrypt},
{"decrypt", blink::WebCryptoKeyUsageDecrypt},
- {"deriveKey", blink::WebCryptoKeyUsageDeriveKey},
- {"deriveBits", blink::WebCryptoKeyUsageDeriveBits},
{"sign", blink::WebCryptoKeyUsageSign},
- {"unwrapKey", blink::WebCryptoKeyUsageUnwrapKey},
{"verify", blink::WebCryptoKeyUsageVerify},
- {"wrapKey", blink::WebCryptoKeyUsageWrapKey}};
+ {"deriveKey", blink::WebCryptoKeyUsageDeriveKey},
+ {"deriveBits", blink::WebCryptoKeyUsageDeriveBits},
+ {"wrapKey", blink::WebCryptoKeyUsageWrapKey},
+ {"unwrapKey", blink::WebCryptoKeyUsageUnwrapKey}};
// Modifies the input usage_mask by according to the key_op value.
bool JwkKeyOpToWebCryptoUsage(const std::string& key_op,
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698