| OLD | NEW |
| (Empty) |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | |
| 2 // Use of this source code is governed by a BSD-style license that can be | |
| 3 // found in the LICENSE file. | |
| 4 | |
| 5 #ifndef CONTENT_CHILD_WEBCRYPTO_OPENSSL_KEY_OPENSSL_H_ | |
| 6 #define CONTENT_CHILD_WEBCRYPTO_OPENSSL_KEY_OPENSSL_H_ | |
| 7 | |
| 8 #include "content/child/webcrypto/algorithm_implementation.h" | |
| 9 | |
| 10 namespace content { | |
| 11 | |
| 12 namespace webcrypto { | |
| 13 | |
| 14 class SymKeyOpenSsl; | |
| 15 | |
| 16 // Base key class for all OpenSSL keys, used to safely cast between types. Each | |
| 17 // key maintains a copy of its serialized form in either 'raw', 'pkcs8', or | |
| 18 // 'spki' format. This is to allow structured cloning of keys synchronously from | |
| 19 // the target Blink thread without having to lock access to the key. | |
| 20 class KeyOpenSsl : public blink::WebCryptoKeyHandle { | |
| 21 public: | |
| 22 explicit KeyOpenSsl(const CryptoData& serialized_key_data); | |
| 23 virtual ~KeyOpenSsl(); | |
| 24 | |
| 25 virtual SymKeyOpenSsl* AsSymKey(); | |
| 26 | |
| 27 const std::vector<uint8>& serialized_key_data() const { | |
| 28 return serialized_key_data_; | |
| 29 } | |
| 30 | |
| 31 private: | |
| 32 const std::vector<uint8> serialized_key_data_; | |
| 33 }; | |
| 34 | |
| 35 class SymKeyOpenSsl : public KeyOpenSsl { | |
| 36 public: | |
| 37 virtual ~SymKeyOpenSsl(); | |
| 38 explicit SymKeyOpenSsl(const CryptoData& raw_key_data); | |
| 39 | |
| 40 static SymKeyOpenSsl* Cast(const blink::WebCryptoKey& key); | |
| 41 | |
| 42 virtual SymKeyOpenSsl* AsSymKey() OVERRIDE; | |
| 43 | |
| 44 const std::vector<uint8>& raw_key_data() const { | |
| 45 return serialized_key_data(); | |
| 46 } | |
| 47 | |
| 48 private: | |
| 49 DISALLOW_COPY_AND_ASSIGN(SymKeyOpenSsl); | |
| 50 }; | |
| 51 | |
| 52 } // namespace webcrypto | |
| 53 | |
| 54 } // namespace content | |
| 55 | |
| 56 #endif // CONTENT_CHILD_WEBCRYPTO_OPENSSL_KEY_OPENSSL_H_ | |
| OLD | NEW |