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

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

Issue 512023002: Refactor the interface for generating keys. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Run git-cl format Created 6 years, 2 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 | « content/child/webcrypto/algorithm_dispatch.cc ('k') | content/child/webcrypto/algorithm_implementation.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: content/child/webcrypto/algorithm_implementation.h
diff --git a/content/child/webcrypto/algorithm_implementation.h b/content/child/webcrypto/algorithm_implementation.h
index 725a8ea474326f7301cc29cb12a64caa3bddd997..1a240e2b3755ac899ff14c4e64e6459bdc37b6e9 100644
--- a/content/child/webcrypto/algorithm_implementation.h
+++ b/content/child/webcrypto/algorithm_implementation.h
@@ -16,6 +16,7 @@ namespace content {
namespace webcrypto {
class CryptoData;
+class GenerateKeyResult;
class Status;
// AlgorithmImplementation is a base class for *executing* the operations of an
@@ -71,32 +72,14 @@ class AlgorithmImplementation {
const CryptoData& data,
std::vector<uint8_t>* buffer) const;
- // VerifyKeyUsagesBeforeGenerateKey() must be called prior to
- // GenerateSecretKey() to validate the requested key usages.
- virtual Status VerifyKeyUsagesBeforeGenerateKey(
- blink::WebCryptoKeyUsageMask usage_mask) const;
-
// This method corresponds to Web Crypto's crypto.subtle.generateKey().
- virtual Status GenerateSecretKey(const blink::WebCryptoAlgorithm& algorithm,
- bool extractable,
- blink::WebCryptoKeyUsageMask usage_mask,
- blink::WebCryptoKey* key) const;
-
- // VerifyKeyUsagesBeforeGenerateKeyPair() must be called prior to
- // GenerateKeyPair() to validate the requested key usages.
- virtual Status VerifyKeyUsagesBeforeGenerateKeyPair(
- blink::WebCryptoKeyUsageMask combined_usage_mask,
- blink::WebCryptoKeyUsageMask* public_usage_mask,
- blink::WebCryptoKeyUsageMask* private_usage_mask) const;
-
- // This method corresponds to Web Crypto's crypto.subtle.generateKey().
- virtual Status GenerateKeyPair(
- const blink::WebCryptoAlgorithm& algorithm,
- bool extractable,
- blink::WebCryptoKeyUsageMask public_usage_mask,
- blink::WebCryptoKeyUsageMask private_usage_mask,
- blink::WebCryptoKey* public_key,
- blink::WebCryptoKey* private_key) const;
+ //
+ // Implementations MUST verify |usage_mask| and return an error if it is not
+ // appropriate.
+ virtual Status GenerateKey(const blink::WebCryptoAlgorithm& algorithm,
+ bool extractable,
+ blink::WebCryptoKeyUsageMask usage_mask,
+ GenerateKeyResult* result) const;
// -----------------------------------------------
// Key import
« no previous file with comments | « content/child/webcrypto/algorithm_dispatch.cc ('k') | content/child/webcrypto/algorithm_implementation.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698