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

Unified Diff: components/webcrypto/algorithms/pbkdf2.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 | « components/webcrypto/algorithms/hkdf.cc ('k') | components/webcrypto/status.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: components/webcrypto/algorithms/pbkdf2.cc
diff --git a/components/webcrypto/algorithms/pbkdf2.cc b/components/webcrypto/algorithms/pbkdf2.cc
index c2aaf6de15a8c2528b9a991c788fd47aef977dfc..f2a8e24bf1faec38447952a7ea6e3b3821845c17 100644
--- a/components/webcrypto/algorithms/pbkdf2.cc
+++ b/components/webcrypto/algorithms/pbkdf2.cc
@@ -50,6 +50,9 @@ class Pbkdf2Implementation : public AlgorithmImplementation {
if (status.IsError())
return status;
+ if (extractable)
+ return Status::ErrorImportExtractableKdfKey();
+
const blink::WebCryptoKeyAlgorithm key_algorithm =
blink::WebCryptoKeyAlgorithm::createWithoutParams(
blink::WebCryptoAlgorithmIdPbkdf2);
@@ -106,6 +109,10 @@ class Pbkdf2Implementation : 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 | « components/webcrypto/algorithms/hkdf.cc ('k') | components/webcrypto/status.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698