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

Unified Diff: components/webcrypto/algorithms/hkdf.cc

Issue 2289033002: Require extractable=false for KDF import (Closed)
Patch Set: update another test Created 4 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
« no previous file with comments | « no previous file | components/webcrypto/algorithms/pbkdf2.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: components/webcrypto/algorithms/hkdf.cc
diff --git a/components/webcrypto/algorithms/hkdf.cc b/components/webcrypto/algorithms/hkdf.cc
index 6b22d248989e80e826fef5170d1a37f8f05d57e6..b2ce2bec354d54fa0e69c5c3c4ec1607c5e1f1b5 100644
--- a/components/webcrypto/algorithms/hkdf.cc
+++ b/components/webcrypto/algorithms/hkdf.cc
@@ -52,6 +52,9 @@ class HkdfImplementation : public AlgorithmImplementation {
if (status.IsError())
return status;
+ if (extractable)
+ return Status::ErrorImportExtractableKdfKey();
+
return CreateWebCryptoSecretKey(
key_data, blink::WebCryptoKeyAlgorithm::createWithoutParams(
blink::WebCryptoAlgorithmIdHkdf),
@@ -102,6 +105,10 @@ class HkdfImplementation : public AlgorithmImplementation {
blink::WebCryptoKeyUsageMask usages,
const CryptoData& key_data,
blink::WebCryptoKey* key) const override {
+ // NOTE: Unlike ImportKeyRaw(), this does not enforce extractable==false.
+ // This is intentional. Although keys cannot currently be created with
+ // extractable==true, earlier implementations permitted this, so
+ // de-serialization by structured clone should not reject them.
return CreateWebCryptoSecretKey(key_data, algorithm, extractable, usages,
key);
}
« no previous file with comments | « no previous file | components/webcrypto/algorithms/pbkdf2.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698