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

Unified Diff: components/webcrypto/algorithm_implementation.cc

Issue 2163053002: [webcrypto] Check for empty key usages *after* key creation rather than before, to match the spec's… (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: rebase Created 4 years, 4 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/algorithm_implementation.h ('k') | components/webcrypto/algorithms/aes.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: components/webcrypto/algorithm_implementation.cc
diff --git a/components/webcrypto/algorithm_implementation.cc b/components/webcrypto/algorithm_implementation.cc
index 8db7482ce73b6048f4fcf232ebd44c171e48241b..fe4622a6e9158ad740c958c2d7e33c09a22f6bd3 100644
--- a/components/webcrypto/algorithm_implementation.cc
+++ b/components/webcrypto/algorithm_implementation.cc
@@ -75,12 +75,6 @@ Status AlgorithmImplementation::GetKeyLength(
return Status::ErrorUnsupported();
}
-Status AlgorithmImplementation::VerifyKeyUsagesBeforeImportKey(
- blink::WebCryptoKeyFormat format,
- blink::WebCryptoKeyUsageMask usages) const {
- return Status::ErrorUnsupportedImportKeyFormat();
-}
-
Status AlgorithmImplementation::ImportKey(
blink::WebCryptoKeyFormat format,
const CryptoData& key_data,
@@ -88,95 +82,13 @@ Status AlgorithmImplementation::ImportKey(
bool extractable,
blink::WebCryptoKeyUsageMask usages,
blink::WebCryptoKey* key) const {
- switch (format) {
- case blink::WebCryptoKeyFormatRaw:
- return ImportKeyRaw(key_data, algorithm, extractable, usages, key);
- case blink::WebCryptoKeyFormatSpki:
- return ImportKeySpki(key_data, algorithm, extractable, usages, key);
- case blink::WebCryptoKeyFormatPkcs8:
- return ImportKeyPkcs8(key_data, algorithm, extractable, usages, key);
- case blink::WebCryptoKeyFormatJwk:
- return ImportKeyJwk(key_data, algorithm, extractable, usages, key);
- default:
- return Status::ErrorUnsupported();
- }
-}
-
-Status AlgorithmImplementation::ImportKeyRaw(
- const CryptoData& key_data,
- const blink::WebCryptoAlgorithm& algorithm,
- bool extractable,
- blink::WebCryptoKeyUsageMask usages,
- blink::WebCryptoKey* key) const {
- return Status::ErrorUnsupportedImportKeyFormat();
-}
-
-Status AlgorithmImplementation::ImportKeyPkcs8(
- const CryptoData& key_data,
- const blink::WebCryptoAlgorithm& algorithm,
- bool extractable,
- blink::WebCryptoKeyUsageMask usages,
- blink::WebCryptoKey* key) const {
- return Status::ErrorUnsupportedImportKeyFormat();
-}
-
-Status AlgorithmImplementation::ImportKeySpki(
- const CryptoData& key_data,
- const blink::WebCryptoAlgorithm& algorithm,
- bool extractable,
- blink::WebCryptoKeyUsageMask usages,
- blink::WebCryptoKey* key) const {
- return Status::ErrorUnsupportedImportKeyFormat();
-}
-
-Status AlgorithmImplementation::ImportKeyJwk(
- const CryptoData& key_data,
- const blink::WebCryptoAlgorithm& algorithm,
- bool extractable,
- blink::WebCryptoKeyUsageMask usages,
- blink::WebCryptoKey* key) const {
- return Status::ErrorUnsupportedImportKeyFormat();
+ return Status::ErrorUnsupported();
}
Status AlgorithmImplementation::ExportKey(blink::WebCryptoKeyFormat format,
const blink::WebCryptoKey& key,
std::vector<uint8_t>* buffer) const {
- switch (format) {
- case blink::WebCryptoKeyFormatRaw:
- return ExportKeyRaw(key, buffer);
- case blink::WebCryptoKeyFormatSpki:
- return ExportKeySpki(key, buffer);
- case blink::WebCryptoKeyFormatPkcs8:
- return ExportKeyPkcs8(key, buffer);
- case blink::WebCryptoKeyFormatJwk:
- return ExportKeyJwk(key, buffer);
- default:
- return Status::ErrorUnsupported();
- }
-}
-
-Status AlgorithmImplementation::ExportKeyRaw(
- const blink::WebCryptoKey& key,
- std::vector<uint8_t>* buffer) const {
- return Status::ErrorUnsupportedExportKeyFormat();
-}
-
-Status AlgorithmImplementation::ExportKeyPkcs8(
- const blink::WebCryptoKey& key,
- std::vector<uint8_t>* buffer) const {
- return Status::ErrorUnsupportedExportKeyFormat();
-}
-
-Status AlgorithmImplementation::ExportKeySpki(
- const blink::WebCryptoKey& key,
- std::vector<uint8_t>* buffer) const {
- return Status::ErrorUnsupportedExportKeyFormat();
-}
-
-Status AlgorithmImplementation::ExportKeyJwk(
- const blink::WebCryptoKey& key,
- std::vector<uint8_t>* buffer) const {
- return Status::ErrorUnsupportedExportKeyFormat();
+ return Status::ErrorUnsupported();
}
Status AlgorithmImplementation::SerializeKeyForClone(
« no previous file with comments | « components/webcrypto/algorithm_implementation.h ('k') | components/webcrypto/algorithms/aes.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698