Index: content/child/webcrypto/openssl/key_openssl.cc |
diff --git a/content/child/webcrypto/crypto_data.cc b/content/child/webcrypto/openssl/key_openssl.cc |
similarity index 22% |
copy from content/child/webcrypto/crypto_data.cc |
copy to content/child/webcrypto/openssl/key_openssl.cc |
index 29736418ae5b1de0716b530b631da8604453237e..ebd45e204b8a7fcce51217cfa279f6f3da76b93d 100644 |
--- a/content/child/webcrypto/crypto_data.cc |
+++ b/content/child/webcrypto/openssl/key_openssl.cc |
@@ -2,27 +2,51 @@ |
// Use of this source code is governed by a BSD-style license that can be |
// found in the LICENSE file. |
+#include "content/child/webcrypto/openssl/key_openssl.h" |
+ |
#include "content/child/webcrypto/crypto_data.h" |
+#include "content/child/webcrypto/status.h" |
+#include "content/child/webcrypto/webcrypto_util.h" |
namespace content { |
namespace webcrypto { |
-CryptoData::CryptoData() : bytes_(NULL), byte_length_(0) {} |
- |
-CryptoData::CryptoData(const unsigned char* bytes, unsigned int byte_length) |
- : bytes_(bytes), byte_length_(byte_length) {} |
- |
-CryptoData::CryptoData(const std::vector<unsigned char>& bytes) |
- : bytes_(bytes.size() ? &bytes[0] : NULL), byte_length_(bytes.size()) {} |
- |
-CryptoData::CryptoData(const std::string& bytes) |
- : bytes_(bytes.size() ? reinterpret_cast<const unsigned char*>(bytes.data()) |
- : NULL), |
- byte_length_(bytes.size()) {} |
- |
-CryptoData::CryptoData(const blink::WebVector<unsigned char>& bytes) |
- : bytes_(bytes.data()), byte_length_(bytes.size()) {} |
+KeyOpenSsl::KeyOpenSsl(const CryptoData& serialized_key_data) |
+ : serialized_key_data_( |
+ serialized_key_data.bytes(), |
+ serialized_key_data.bytes() + serialized_key_data.byte_length()) { |
+} |
+ |
+KeyOpenSsl::~KeyOpenSsl() { |
+} |
+ |
+SymKeyOpenSsl* KeyOpenSsl::AsSymKey() { |
+ return NULL; |
+} |
+ |
+SymKeyOpenSsl::~SymKeyOpenSsl() { |
+} |
+ |
+SymKeyOpenSsl* SymKeyOpenSsl::Cast(const blink::WebCryptoKey& key) { |
+ KeyOpenSsl* platform_key = reinterpret_cast<KeyOpenSsl*>(key.handle()); |
+ return platform_key->AsSymKey(); |
+} |
+ |
+SymKeyOpenSsl* SymKeyOpenSsl::AsSymKey() { |
+ return this; |
+} |
+ |
+SymKeyOpenSsl::SymKeyOpenSsl(const CryptoData& raw_key_data) |
+ : KeyOpenSsl(raw_key_data) { |
+} |
+ |
+bool PlatformSerializeKeyForClone(const blink::WebCryptoKey& key, |
+ blink::WebVector<uint8>* key_data) { |
+ const KeyOpenSsl* openssl_key = static_cast<KeyOpenSsl*>(key.handle()); |
+ *key_data = openssl_key->serialized_key_data(); |
+ return true; |
+} |
} // namespace webcrypto |