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

Unified Diff: Source/modules/crypto/SubtleCrypto.cpp

Issue 18475002: WebCrypto: Add framework for AlgorithmIdentifier normalization. (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: rename verify --> verifySignature (because "verify" is a macro on Mac) Created 7 years, 6 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 | « Source/modules/crypto/SubtleCrypto.h ('k') | Source/modules/crypto/SubtleCrypto.idl » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: Source/modules/crypto/SubtleCrypto.cpp
diff --git a/Source/modules/crypto/SubtleCrypto.cpp b/Source/modules/crypto/SubtleCrypto.cpp
index 509d56585a70a4df25300660b6c51cdf48e25cf9..cf30ddd50fa4b77964f14a94c0749893c7d31525 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::verifySignature(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
« no previous file with comments | « Source/modules/crypto/SubtleCrypto.h ('k') | Source/modules/crypto/SubtleCrypto.idl » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698