Index: Source/modules/crypto/SubtleCrypto.cpp |
diff --git a/Source/modules/crypto/SubtleCrypto.cpp b/Source/modules/crypto/SubtleCrypto.cpp |
index 509d56585a70a4df25300660b6c51cdf48e25cf9..c9c56f1d931c04777c4edba139fd0f84c6cff660 100644 |
--- a/Source/modules/crypto/SubtleCrypto.cpp |
+++ b/Source/modules/crypto/SubtleCrypto.cpp |
@@ -31,6 +31,9 @@ |
#include "modules/crypto/SubtleCrypto.h" |
#include "core/dom/ExceptionCode.h" |
+#include "modules/crypto/CryptoOperation.h" |
+#include "modules/crypto/NormalizeAlgorithm.h" |
+#include "wtf/ArrayBuffer.h" |
#include "wtf/ArrayBufferView.h" |
namespace WebCore { |
@@ -40,4 +43,44 @@ SubtleCrypto::SubtleCrypto() |
ScriptWrappable::init(this); |
} |
+PassRefPtr<CryptoOperation> SubtleCrypto::encrypt(const Dictionary& rawAlgorithm, ExceptionCode& ec) |
+{ |
+ WebKit::WebCryptoAlgorithm algorithm; |
+ if (!normalizeAlgorithm(rawAlgorithm, Encrypt, algorithm, ec)) |
+ return 0; |
+ return CryptoOperation::create(algorithm); |
+} |
+ |
+PassRefPtr<CryptoOperation> SubtleCrypto::decrypt(const Dictionary& rawAlgorithm, ExceptionCode& ec) |
+{ |
+ WebKit::WebCryptoAlgorithm algorithm; |
+ if (!normalizeAlgorithm(rawAlgorithm, Decrypt, algorithm, ec)) |
+ return 0; |
+ return CryptoOperation::create(algorithm); |
+} |
+ |
+PassRefPtr<CryptoOperation> SubtleCrypto::sign(const Dictionary& rawAlgorithm, ExceptionCode& ec) |
+{ |
+ WebKit::WebCryptoAlgorithm algorithm; |
+ if (!normalizeAlgorithm(rawAlgorithm, Sign, algorithm, ec)) |
+ return 0; |
+ return CryptoOperation::create(algorithm); |
} |
+ |
+PassRefPtr<CryptoOperation> SubtleCrypto::verify(const Dictionary& rawAlgorithm, ExceptionCode& ec) |
+{ |
+ WebKit::WebCryptoAlgorithm algorithm; |
+ if (!normalizeAlgorithm(rawAlgorithm, Verify, algorithm, ec)) |
+ return 0; |
+ return CryptoOperation::create(algorithm); |
+} |
+ |
+PassRefPtr<CryptoOperation> SubtleCrypto::digest(const Dictionary& rawAlgorithm, ExceptionCode& ec) |
+{ |
+ WebKit::WebCryptoAlgorithm algorithm; |
+ if (!normalizeAlgorithm(rawAlgorithm, Digest, algorithm, ec)) |
+ return 0; |
+ return CryptoOperation::create(algorithm); |
+} |
+ |
+} // namespace WebCore |