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