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

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

Issue 23617006: WebCrypto: Add the KeyPair interface. (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: rebase onto master Created 7 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 | « Source/modules/crypto/KeyPair.h ('k') | Source/modules/crypto/KeyPair.idl » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: Source/modules/crypto/KeyPair.cpp
diff --git a/Source/modules/crypto/AesCbcParams.cpp b/Source/modules/crypto/KeyPair.cpp
similarity index 72%
copy from Source/modules/crypto/AesCbcParams.cpp
copy to Source/modules/crypto/KeyPair.cpp
index e84bc7a2c984a644833b2bd67b73973315729a3e..6b47bc5f8a0b51e85b7f1784ca123b5bbd026095 100644
--- a/Source/modules/crypto/AesCbcParams.cpp
+++ b/Source/modules/crypto/KeyPair.cpp
@@ -29,25 +29,26 @@
*/
#include "config.h"
-#include "modules/crypto/AesCbcParams.h"
+#include "modules/crypto/KeyPair.h"
-#include "public/platform/WebCryptoAlgorithmParams.h"
+#include "modules/crypto/Key.h"
+#include "public/platform/WebCryptoKey.h"
namespace WebCore {
-Uint8Array* AesCbcParams::iv()
+PassRefPtr<KeyPair> KeyPair::create(const WebKit::WebCryptoKey& publicKey, const WebKit::WebCryptoKey& privateKey)
{
- if (!m_iv) {
- const WebKit::WebVector<unsigned char>& iv = m_algorithm.aesCbcParams()->iv();
- m_iv = Uint8Array::create(iv.data(), iv.size());
- }
- return m_iv.get();
+ ASSERT(publicKey.type() == WebKit::WebCryptoKeyTypePublic);
+ ASSERT(privateKey.type() == WebKit::WebCryptoKeyTypePrivate);
+ return adoptRef(new KeyPair(Key::create(publicKey), Key::create(privateKey)));
}
-AesCbcParams::AesCbcParams(const WebKit::WebCryptoAlgorithm& algorithm)
- : Algorithm(algorithm)
+KeyPair::KeyPair(const PassRefPtr<Key>& publicKey, const PassRefPtr<Key>& privateKey)
+ : m_publicKey(publicKey)
+ , m_privateKey(privateKey)
{
- ASSERT(algorithm.aesCbcParams());
+ ASSERT(publicKey);
+ ASSERT(privateKey);
ScriptWrappable::init(this);
}
« no previous file with comments | « Source/modules/crypto/KeyPair.h ('k') | Source/modules/crypto/KeyPair.idl » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698