| 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 #include "components/webcrypto/openssl/key_openssl.h" | |
| 6 | |
| 7 #include "components/webcrypto/crypto_data.h" | |
| 8 #include "components/webcrypto/status.h" | |
| 9 #include "components/webcrypto/webcrypto_util.h" | |
| 10 | |
| 11 namespace webcrypto { | |
| 12 | |
| 13 KeyOpenSsl::KeyOpenSsl(const CryptoData& serialized_key_data) | |
| 14 : serialized_key_data_( | |
| 15 serialized_key_data.bytes(), | |
| 16 serialized_key_data.bytes() + serialized_key_data.byte_length()) { | |
| 17 } | |
| 18 | |
| 19 KeyOpenSsl::~KeyOpenSsl() { | |
| 20 } | |
| 21 | |
| 22 SymKeyOpenSsl* KeyOpenSsl::AsSymKey() { | |
| 23 return NULL; | |
| 24 } | |
| 25 | |
| 26 AsymKeyOpenSsl* KeyOpenSsl::AsAsymKey() { | |
| 27 return NULL; | |
| 28 } | |
| 29 | |
| 30 SymKeyOpenSsl::~SymKeyOpenSsl() { | |
| 31 } | |
| 32 | |
| 33 SymKeyOpenSsl* SymKeyOpenSsl::Cast(const blink::WebCryptoKey& key) { | |
| 34 KeyOpenSsl* platform_key = reinterpret_cast<KeyOpenSsl*>(key.handle()); | |
| 35 return platform_key->AsSymKey(); | |
| 36 } | |
| 37 | |
| 38 SymKeyOpenSsl* SymKeyOpenSsl::AsSymKey() { | |
| 39 return this; | |
| 40 } | |
| 41 | |
| 42 SymKeyOpenSsl::SymKeyOpenSsl(const CryptoData& raw_key_data) | |
| 43 : KeyOpenSsl(raw_key_data) { | |
| 44 } | |
| 45 | |
| 46 AsymKeyOpenSsl::~AsymKeyOpenSsl() { | |
| 47 } | |
| 48 | |
| 49 AsymKeyOpenSsl* AsymKeyOpenSsl::Cast(const blink::WebCryptoKey& key) { | |
| 50 return reinterpret_cast<KeyOpenSsl*>(key.handle())->AsAsymKey(); | |
| 51 } | |
| 52 | |
| 53 AsymKeyOpenSsl* AsymKeyOpenSsl::AsAsymKey() { | |
| 54 return this; | |
| 55 } | |
| 56 | |
| 57 AsymKeyOpenSsl::AsymKeyOpenSsl(crypto::ScopedEVP_PKEY key, | |
| 58 const CryptoData& serialized_key_data) | |
| 59 : KeyOpenSsl(serialized_key_data), key_(key.Pass()) { | |
| 60 } | |
| 61 | |
| 62 } // namespace webcrypto | |
| OLD | NEW |