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

Unified Diff: content/child/webcrypto/openssl/key_openssl.h

Issue 379383002: Refactor WebCrypto code (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Rebase onto master (no longer has BoringSSL) Created 6 years, 5 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 | « content/child/webcrypto/openssl/hmac_openssl.cc ('k') | content/child/webcrypto/openssl/key_openssl.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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_
« no previous file with comments | « content/child/webcrypto/openssl/hmac_openssl.cc ('k') | content/child/webcrypto/openssl/key_openssl.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698