Vectorize website settings icons in omnibox
[chromium-blink-merge.git] / components / webcrypto / openssl / key_openssl.cc
blob60922a47a82dc28d7d5110ee2d8911cfb09565c2
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.
5 #include "components/webcrypto/openssl/key_openssl.h"
7 #include "components/webcrypto/crypto_data.h"
8 #include "components/webcrypto/status.h"
9 #include "components/webcrypto/webcrypto_util.h"
11 namespace webcrypto {
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()) {
19 KeyOpenSsl::~KeyOpenSsl() {
22 SymKeyOpenSsl* KeyOpenSsl::AsSymKey() {
23 return NULL;
26 AsymKeyOpenSsl* KeyOpenSsl::AsAsymKey() {
27 return NULL;
30 SymKeyOpenSsl::~SymKeyOpenSsl() {
33 SymKeyOpenSsl* SymKeyOpenSsl::Cast(const blink::WebCryptoKey& key) {
34 KeyOpenSsl* platform_key = reinterpret_cast<KeyOpenSsl*>(key.handle());
35 return platform_key->AsSymKey();
38 SymKeyOpenSsl* SymKeyOpenSsl::AsSymKey() {
39 return this;
42 SymKeyOpenSsl::SymKeyOpenSsl(const CryptoData& raw_key_data)
43 : KeyOpenSsl(raw_key_data) {
46 AsymKeyOpenSsl::~AsymKeyOpenSsl() {
49 AsymKeyOpenSsl* AsymKeyOpenSsl::Cast(const blink::WebCryptoKey& key) {
50 return reinterpret_cast<KeyOpenSsl*>(key.handle())->AsAsymKey();
53 AsymKeyOpenSsl* AsymKeyOpenSsl::AsAsymKey() {
54 return this;
57 AsymKeyOpenSsl::AsymKeyOpenSsl(crypto::ScopedEVP_PKEY key,
58 const CryptoData& serialized_key_data)
59 : KeyOpenSsl(serialized_key_data), key_(key.Pass()) {
62 } // namespace webcrypto