| Index: Source/modules/crypto/SubtleCrypto.cpp
|
| diff --git a/Source/modules/crypto/SubtleCrypto.cpp b/Source/modules/crypto/SubtleCrypto.cpp
|
| index 06213e14adb32cc8e80877ba56c444623e598a82..25c0d724e0f4445f144fed87ce2474ed6d77e544 100644
|
| --- a/Source/modules/crypto/SubtleCrypto.cpp
|
| +++ b/Source/modules/crypto/SubtleCrypto.cpp
|
| @@ -176,4 +176,25 @@ ScriptObject SubtleCrypto::importKey(const String& rawFormat, ArrayBufferView* k
|
| return result->promise();
|
| }
|
|
|
| +ScriptObject SubtleCrypto::exportKey(const String& rawFormat, Key* key, ExceptionState& es)
|
| +{
|
| + WebKit::WebCryptoKeyFormat format;
|
| + if (!Key::parseFormat(rawFormat, format, es))
|
| + return ScriptObject();
|
| +
|
| + if (!key) {
|
| + es.throwTypeError("Invalid key argument");
|
| + return ScriptObject();
|
| + }
|
| +
|
| + if (!key->extractable()) {
|
| + es.throwDOMException(NotSupportedError, "key is not extractable");
|
| + return ScriptObject();
|
| + }
|
| +
|
| + RefPtr<CryptoResult> result = CryptoResult::create();
|
| + WebKit::Platform::current()->crypto()->exportKey(format, key->key(), result->result());
|
| + return result->promise();
|
| +}
|
| +
|
| } // namespace WebCore
|
|
|