| 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 #ifndef COMPONENTS_WEBCRYPTO_BLINK_KEY_HANDLE_H_ | 5 #ifndef COMPONENTS_WEBCRYPTO_BLINK_KEY_HANDLE_H_ |
| 6 #define COMPONENTS_WEBCRYPTO_BLINK_KEY_HANDLE_H_ | 6 #define COMPONENTS_WEBCRYPTO_BLINK_KEY_HANDLE_H_ |
| 7 | 7 |
| 8 #include <openssl/base.h> | 8 #include <openssl/base.h> |
| 9 #include <stdint.h> | 9 #include <stdint.h> |
| 10 | 10 |
| 11 #include <vector> | 11 #include <vector> |
| 12 | 12 |
| 13 #include "crypto/scoped_openssl_types.h" | |
| 14 #include "third_party/WebKit/public/platform/WebCryptoKey.h" | 13 #include "third_party/WebKit/public/platform/WebCryptoKey.h" |
| 15 | 14 |
| 16 // Blink keys (blink::WebCryptoKey) have an associated key handle | 15 // Blink keys (blink::WebCryptoKey) have an associated key handle |
| 17 // (blink::WebCryptoKeyHandle) used to store custom data. This is where the | 16 // (blink::WebCryptoKeyHandle) used to store custom data. This is where the |
| 18 // underlying EVP_PKEY is stored for asymmetric keys, or an std::vector | 17 // underlying EVP_PKEY is stored for asymmetric keys, or an std::vector |
| 19 // containing the bytes for symmetric keys. | 18 // containing the bytes for symmetric keys. |
| 20 // | 19 // |
| 21 // This file contains helpers for creating the key handles, and extracting | 20 // This file contains helpers for creating the key handles, and extracting |
| 22 // properties from it. | 21 // properties from it. |
| 23 | 22 |
| (...skipping 22 matching lines...) Expand all Loading... |
| 46 const CryptoData& key_bytes); | 45 const CryptoData& key_bytes); |
| 47 | 46 |
| 48 // Creates an asymmetric key handle that can be passed to Blink. The caller | 47 // Creates an asymmetric key handle that can be passed to Blink. The caller |
| 49 // takes | 48 // takes |
| 50 // ownership of the returned pointer. | 49 // ownership of the returned pointer. |
| 51 // | 50 // |
| 52 // TODO(eroman): This should _move_ input serialized_key_data rather than | 51 // TODO(eroman): This should _move_ input serialized_key_data rather than |
| 53 // create a copy, since all the callers are passing in vectors that are later | 52 // create a copy, since all the callers are passing in vectors that are later |
| 54 // thrown away anyway. | 53 // thrown away anyway. |
| 55 blink::WebCryptoKeyHandle* CreateAsymmetricKeyHandle( | 54 blink::WebCryptoKeyHandle* CreateAsymmetricKeyHandle( |
| 56 crypto::ScopedEVP_PKEY pkey, | 55 bssl::UniquePtr<EVP_PKEY> pkey, |
| 57 const std::vector<uint8_t>& serialized_key_data); | 56 const std::vector<uint8_t>& serialized_key_data); |
| 58 | 57 |
| 59 } // namespace webcrypto | 58 } // namespace webcrypto |
| 60 | 59 |
| 61 #endif // COMPONENTS_WEBCRYPTO_BLINK_KEY_HANDLE_H_ | 60 #endif // COMPONENTS_WEBCRYPTO_BLINK_KEY_HANDLE_H_ |
| OLD | NEW |