Index: content/child/webcrypto/openssl/key_openssl.h |
diff --git a/content/child/webcrypto/openssl/key_openssl.h b/content/child/webcrypto/openssl/key_openssl.h |
new file mode 100644 |
index 0000000000000000000000000000000000000000..ef3243893106161c24c0a9b7d3bdbd5356d9e1e9 |
--- /dev/null |
+++ b/content/child/webcrypto/openssl/key_openssl.h |
@@ -0,0 +1,56 @@ |
+// Copyright 2014 The Chromium Authors. All rights reserved. |
+// Use of this source code is governed by a BSD-style license that can be |
+// found in the LICENSE file. |
+ |
+#ifndef CONTENT_CHILD_WEBCRYPTO_OPENSSL_KEY_OPENSSL_H_ |
+#define CONTENT_CHILD_WEBCRYPTO_OPENSSL_KEY_OPENSSL_H_ |
+ |
+#include "content/child/webcrypto/algorithm_implementation.h" |
+ |
+namespace content { |
+ |
+namespace webcrypto { |
+ |
+class SymKeyOpenSsl; |
+ |
+// Base key class for all OpenSSL keys, used to safely cast between types. Each |
+// key maintains a copy of its serialized form in either 'raw', 'pkcs8', or |
+// 'spki' format. This is to allow structured cloning of keys synchronously from |
+// the target Blink thread without having to lock access to the key. |
+class KeyOpenSsl : public blink::WebCryptoKeyHandle { |
+ public: |
+ explicit KeyOpenSsl(const CryptoData& serialized_key_data); |
+ virtual ~KeyOpenSsl(); |
+ |
+ virtual SymKeyOpenSsl* AsSymKey(); |
+ |
+ const std::vector<uint8>& serialized_key_data() const { |
+ return serialized_key_data_; |
+ } |
+ |
+ private: |
+ const std::vector<uint8> serialized_key_data_; |
+}; |
+ |
+class SymKeyOpenSsl : public KeyOpenSsl { |
+ public: |
+ virtual ~SymKeyOpenSsl(); |
+ explicit SymKeyOpenSsl(const CryptoData& raw_key_data); |
+ |
+ static SymKeyOpenSsl* Cast(const blink::WebCryptoKey& key); |
+ |
+ virtual SymKeyOpenSsl* AsSymKey() OVERRIDE; |
+ |
+ const std::vector<uint8>& raw_key_data() const { |
+ return serialized_key_data(); |
+ } |
+ |
+ private: |
+ DISALLOW_COPY_AND_ASSIGN(SymKeyOpenSsl); |
+}; |
+ |
+} // namespace webcrypto |
+ |
+} // namespace content |
+ |
+#endif // CONTENT_CHILD_WEBCRYPTO_OPENSSL_KEY_OPENSSL_H_ |