| Index: content/child/webcrypto/algorithm_implementation.cc
|
| diff --git a/content/child/webcrypto/algorithm_implementation.cc b/content/child/webcrypto/algorithm_implementation.cc
|
| index 6b9f7f9fc951779c63f1996f573d33774f0c01fe..3a62134f2df6aa6aabf441295481830129534ec5 100644
|
| --- a/content/child/webcrypto/algorithm_implementation.cc
|
| +++ b/content/child/webcrypto/algorithm_implementation.cc
|
| @@ -74,6 +74,27 @@ Status AlgorithmImplementation::VerifyKeyUsagesBeforeImportKey(
|
| return Status::ErrorUnsupportedImportKeyFormat();
|
| }
|
|
|
| +Status AlgorithmImplementation::ImportKey(
|
| + blink::WebCryptoKeyFormat format,
|
| + const CryptoData& key_data,
|
| + const blink::WebCryptoAlgorithm& algorithm,
|
| + 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,
|
| @@ -110,6 +131,23 @@ Status AlgorithmImplementation::ImportKeyJwk(
|
| return Status::ErrorUnsupportedImportKeyFormat();
|
| }
|
|
|
| +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 {
|
|
|