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

Unified Diff: content/child/webcrypto/algorithm_dispatch.h

Issue 749183004: WebCrypto: Implement crypto.subtle.deriveKey (chromium-side). (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@ecdh
Patch Set: rebase Created 6 years 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 | content/child/webcrypto/algorithm_dispatch.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: content/child/webcrypto/algorithm_dispatch.h
diff --git a/content/child/webcrypto/algorithm_dispatch.h b/content/child/webcrypto/algorithm_dispatch.h
index 977b792045f9d03c93d3bd81e385cf95ce7f2e84..5249d4f7620bf2571b888519a6434a7fbe5eae43 100644
--- a/content/child/webcrypto/algorithm_dispatch.h
+++ b/content/child/webcrypto/algorithm_dispatch.h
@@ -92,6 +92,34 @@ CONTENT_EXPORT Status DeriveBits(const blink::WebCryptoAlgorithm& algorithm,
unsigned int length_bits,
std::vector<uint8_t>* derived_bytes);
+// Derives a key by calling the underlying deriveBits/getKeyLength/importKey
+// operations.
+//
+// Note that whereas the WebCrypto spec uses a single "derivedKeyType"
+// AlgorithmIdentifier in its specification of deriveKey(), here two separate
+// AlgorithmIdentifiers are used:
+//
+// * |import_algorithm| -- The parameters required by the derived key's
+// "importKey" operation.
+//
+// * |key_length_algorithm| -- The parameters required by the derived key's
+// "get key length" operation.
+//
+// WebCryptoAlgorithm is not a flexible type like AlgorithmIdentifier (it cannot
+// be easily re-interpreted as a different parameter type).
+//
+// Therefore being provided with separate parameter types for the import
+// parameters and the key length parameters simplifies passing the right
+// parameters onto ImportKey() and GetKeyLength() respectively.
+CONTENT_EXPORT Status
+DeriveKey(const blink::WebCryptoAlgorithm& algorithm,
+ const blink::WebCryptoKey& base_key,
+ const blink::WebCryptoAlgorithm& import_algorithm,
+ const blink::WebCryptoAlgorithm& key_length_algorithm,
+ bool extractable,
+ blink::WebCryptoKeyUsageMask usages,
+ blink::WebCryptoKey* derived_key);
+
CONTENT_EXPORT scoped_ptr<blink::WebCryptoDigestor> CreateDigestor(
blink::WebCryptoAlgorithmId algorithm);
« no previous file with comments | « no previous file | content/child/webcrypto/algorithm_dispatch.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698