| OLD | NEW |
| 1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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 #include "components/webcrypto/blink_key_handle.h" | 5 #include "components/webcrypto/blink_key_handle.h" |
| 6 | 6 |
| 7 #include <utility> |
| 8 |
| 7 #include "base/logging.h" | 9 #include "base/logging.h" |
| 8 #include "base/macros.h" | 10 #include "base/macros.h" |
| 9 #include "components/webcrypto/crypto_data.h" | 11 #include "components/webcrypto/crypto_data.h" |
| 10 #include "components/webcrypto/status.h" | 12 #include "components/webcrypto/status.h" |
| 11 | 13 |
| 12 namespace webcrypto { | 14 namespace webcrypto { |
| 13 | 15 |
| 14 namespace { | 16 namespace { |
| 15 | 17 |
| 16 class SymKey; | 18 class SymKey; |
| (...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 56 } | 58 } |
| 57 | 59 |
| 58 private: | 60 private: |
| 59 DISALLOW_COPY_AND_ASSIGN(SymKey); | 61 DISALLOW_COPY_AND_ASSIGN(SymKey); |
| 60 }; | 62 }; |
| 61 | 63 |
| 62 class AsymKey : public Key { | 64 class AsymKey : public Key { |
| 63 public: | 65 public: |
| 64 AsymKey(crypto::ScopedEVP_PKEY pkey, | 66 AsymKey(crypto::ScopedEVP_PKEY pkey, |
| 65 const std::vector<uint8_t>& serialized_key_data) | 67 const std::vector<uint8_t>& serialized_key_data) |
| 66 : Key(CryptoData(serialized_key_data)), pkey_(pkey.Pass()) {} | 68 : Key(CryptoData(serialized_key_data)), pkey_(std::move(pkey)) {} |
| 67 | 69 |
| 68 AsymKey* AsAsymKey() override { return this; } | 70 AsymKey* AsAsymKey() override { return this; } |
| 69 | 71 |
| 70 EVP_PKEY* pkey() { return pkey_.get(); } | 72 EVP_PKEY* pkey() { return pkey_.get(); } |
| 71 | 73 |
| 72 private: | 74 private: |
| 73 crypto::ScopedEVP_PKEY pkey_; | 75 crypto::ScopedEVP_PKEY pkey_; |
| 74 | 76 |
| 75 DISALLOW_COPY_AND_ASSIGN(AsymKey); | 77 DISALLOW_COPY_AND_ASSIGN(AsymKey); |
| 76 }; | 78 }; |
| (...skipping 21 matching lines...) Expand all Loading... |
| 98 } | 100 } |
| 99 | 101 |
| 100 blink::WebCryptoKeyHandle* CreateSymmetricKeyHandle( | 102 blink::WebCryptoKeyHandle* CreateSymmetricKeyHandle( |
| 101 const CryptoData& key_bytes) { | 103 const CryptoData& key_bytes) { |
| 102 return new SymKey(key_bytes); | 104 return new SymKey(key_bytes); |
| 103 } | 105 } |
| 104 | 106 |
| 105 blink::WebCryptoKeyHandle* CreateAsymmetricKeyHandle( | 107 blink::WebCryptoKeyHandle* CreateAsymmetricKeyHandle( |
| 106 crypto::ScopedEVP_PKEY pkey, | 108 crypto::ScopedEVP_PKEY pkey, |
| 107 const std::vector<uint8_t>& serialized_key_data) { | 109 const std::vector<uint8_t>& serialized_key_data) { |
| 108 return new AsymKey(pkey.Pass(), serialized_key_data); | 110 return new AsymKey(std::move(pkey), serialized_key_data); |
| 109 } | 111 } |
| 110 | 112 |
| 111 } // namespace webcrypto | 113 } // namespace webcrypto |
| OLD | NEW |