| 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 <openssl/ossl_typ.h> | 8 #include <openssl/ossl_typ.h> |
| 9 #include <stdint.h> | 9 #include <stdint.h> |
| 10 #include <vector> | 10 #include <vector> |
| (...skipping 30 matching lines...) Expand all Loading... |
| 41 const std::vector<uint8_t> serialized_key_data_; | 41 const std::vector<uint8_t> serialized_key_data_; |
| 42 }; | 42 }; |
| 43 | 43 |
| 44 class SymKeyOpenSsl : public KeyOpenSsl { | 44 class SymKeyOpenSsl : public KeyOpenSsl { |
| 45 public: | 45 public: |
| 46 virtual ~SymKeyOpenSsl(); | 46 virtual ~SymKeyOpenSsl(); |
| 47 explicit SymKeyOpenSsl(const CryptoData& raw_key_data); | 47 explicit SymKeyOpenSsl(const CryptoData& raw_key_data); |
| 48 | 48 |
| 49 static SymKeyOpenSsl* Cast(const blink::WebCryptoKey& key); | 49 static SymKeyOpenSsl* Cast(const blink::WebCryptoKey& key); |
| 50 | 50 |
| 51 virtual SymKeyOpenSsl* AsSymKey() override; | 51 SymKeyOpenSsl* AsSymKey() override; |
| 52 | 52 |
| 53 const std::vector<uint8_t>& raw_key_data() const { | 53 const std::vector<uint8_t>& raw_key_data() const { |
| 54 return serialized_key_data(); | 54 return serialized_key_data(); |
| 55 } | 55 } |
| 56 | 56 |
| 57 private: | 57 private: |
| 58 DISALLOW_COPY_AND_ASSIGN(SymKeyOpenSsl); | 58 DISALLOW_COPY_AND_ASSIGN(SymKeyOpenSsl); |
| 59 }; | 59 }; |
| 60 | 60 |
| 61 class AsymKeyOpenSsl : public KeyOpenSsl { | 61 class AsymKeyOpenSsl : public KeyOpenSsl { |
| 62 public: | 62 public: |
| 63 virtual ~AsymKeyOpenSsl(); | 63 virtual ~AsymKeyOpenSsl(); |
| 64 AsymKeyOpenSsl(crypto::ScopedEVP_PKEY key, | 64 AsymKeyOpenSsl(crypto::ScopedEVP_PKEY key, |
| 65 const CryptoData& serialized_key_data); | 65 const CryptoData& serialized_key_data); |
| 66 | 66 |
| 67 static AsymKeyOpenSsl* Cast(const blink::WebCryptoKey& key); | 67 static AsymKeyOpenSsl* Cast(const blink::WebCryptoKey& key); |
| 68 | 68 |
| 69 virtual AsymKeyOpenSsl* AsAsymKey() override; | 69 AsymKeyOpenSsl* AsAsymKey() override; |
| 70 | 70 |
| 71 EVP_PKEY* key() { return key_.get(); } | 71 EVP_PKEY* key() { return key_.get(); } |
| 72 | 72 |
| 73 private: | 73 private: |
| 74 crypto::ScopedEVP_PKEY key_; | 74 crypto::ScopedEVP_PKEY key_; |
| 75 | 75 |
| 76 DISALLOW_COPY_AND_ASSIGN(AsymKeyOpenSsl); | 76 DISALLOW_COPY_AND_ASSIGN(AsymKeyOpenSsl); |
| 77 }; | 77 }; |
| 78 | 78 |
| 79 } // namespace webcrypto | 79 } // namespace webcrypto |
| 80 | 80 |
| 81 } // namespace content | 81 } // namespace content |
| 82 | 82 |
| 83 #endif // CONTENT_CHILD_WEBCRYPTO_OPENSSL_KEY_OPENSSL_H_ | 83 #endif // CONTENT_CHILD_WEBCRYPTO_OPENSSL_KEY_OPENSSL_H_ |
| OLD | NEW |