ExtensionInstallDialogView: fix scrolling behavior on Views (Win,Linux)
[chromium-blink-merge.git] / components / webcrypto / algorithm_implementation.cc
blob1d98b4427ba8b5a381994db3f80aa2509a807759
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/algorithm_implementation.h"
7 #include "components/webcrypto/status.h"
9 namespace webcrypto {
11 AlgorithmImplementation::~AlgorithmImplementation() {
14 Status AlgorithmImplementation::Encrypt(
15 const blink::WebCryptoAlgorithm& algorithm,
16 const blink::WebCryptoKey& key,
17 const CryptoData& data,
18 std::vector<uint8_t>* buffer) const {
19 return Status::ErrorUnsupported();
22 Status AlgorithmImplementation::Decrypt(
23 const blink::WebCryptoAlgorithm& algorithm,
24 const blink::WebCryptoKey& key,
25 const CryptoData& data,
26 std::vector<uint8_t>* buffer) const {
27 return Status::ErrorUnsupported();
30 Status AlgorithmImplementation::Sign(const blink::WebCryptoAlgorithm& algorithm,
31 const blink::WebCryptoKey& key,
32 const CryptoData& data,
33 std::vector<uint8_t>* buffer) const {
34 return Status::ErrorUnsupported();
37 Status AlgorithmImplementation::Verify(
38 const blink::WebCryptoAlgorithm& algorithm,
39 const blink::WebCryptoKey& key,
40 const CryptoData& signature,
41 const CryptoData& data,
42 bool* signature_match) const {
43 return Status::ErrorUnsupported();
46 Status AlgorithmImplementation::Digest(
47 const blink::WebCryptoAlgorithm& algorithm,
48 const CryptoData& data,
49 std::vector<uint8_t>* buffer) const {
50 return Status::ErrorUnsupported();
53 Status AlgorithmImplementation::GenerateKey(
54 const blink::WebCryptoAlgorithm& algorithm,
55 bool extractable,
56 blink::WebCryptoKeyUsageMask usages,
57 GenerateKeyResult* result) const {
58 return Status::ErrorUnsupported();
61 Status AlgorithmImplementation::DeriveBits(
62 const blink::WebCryptoAlgorithm& algorithm,
63 const blink::WebCryptoKey& base_key,
64 bool has_optional_length_bits,
65 unsigned int optional_length_bits,
66 std::vector<uint8_t>* derived_bytes) const {
67 return Status::ErrorUnsupported();
70 Status AlgorithmImplementation::GetKeyLength(
71 const blink::WebCryptoAlgorithm& key_length_algorithm,
72 bool* has_length_bits,
73 unsigned int* length_bits) const {
74 return Status::ErrorUnsupported();
77 Status AlgorithmImplementation::VerifyKeyUsagesBeforeImportKey(
78 blink::WebCryptoKeyFormat format,
79 blink::WebCryptoKeyUsageMask usages) const {
80 return Status::ErrorUnsupportedImportKeyFormat();
83 Status AlgorithmImplementation::ImportKey(
84 blink::WebCryptoKeyFormat format,
85 const CryptoData& key_data,
86 const blink::WebCryptoAlgorithm& algorithm,
87 bool extractable,
88 blink::WebCryptoKeyUsageMask usages,
89 blink::WebCryptoKey* key) const {
90 switch (format) {
91 case blink::WebCryptoKeyFormatRaw:
92 return ImportKeyRaw(key_data, algorithm, extractable, usages, key);
93 case blink::WebCryptoKeyFormatSpki:
94 return ImportKeySpki(key_data, algorithm, extractable, usages, key);
95 case blink::WebCryptoKeyFormatPkcs8:
96 return ImportKeyPkcs8(key_data, algorithm, extractable, usages, key);
97 case blink::WebCryptoKeyFormatJwk:
98 return ImportKeyJwk(key_data, algorithm, extractable, usages, key);
99 default:
100 return Status::ErrorUnsupported();
104 Status AlgorithmImplementation::ImportKeyRaw(
105 const CryptoData& key_data,
106 const blink::WebCryptoAlgorithm& algorithm,
107 bool extractable,
108 blink::WebCryptoKeyUsageMask usages,
109 blink::WebCryptoKey* key) const {
110 return Status::ErrorUnsupportedImportKeyFormat();
113 Status AlgorithmImplementation::ImportKeyPkcs8(
114 const CryptoData& key_data,
115 const blink::WebCryptoAlgorithm& algorithm,
116 bool extractable,
117 blink::WebCryptoKeyUsageMask usages,
118 blink::WebCryptoKey* key) const {
119 return Status::ErrorUnsupportedImportKeyFormat();
122 Status AlgorithmImplementation::ImportKeySpki(
123 const CryptoData& key_data,
124 const blink::WebCryptoAlgorithm& algorithm,
125 bool extractable,
126 blink::WebCryptoKeyUsageMask usages,
127 blink::WebCryptoKey* key) const {
128 return Status::ErrorUnsupportedImportKeyFormat();
131 Status AlgorithmImplementation::ImportKeyJwk(
132 const CryptoData& key_data,
133 const blink::WebCryptoAlgorithm& algorithm,
134 bool extractable,
135 blink::WebCryptoKeyUsageMask usages,
136 blink::WebCryptoKey* key) const {
137 return Status::ErrorUnsupportedImportKeyFormat();
140 Status AlgorithmImplementation::ExportKey(blink::WebCryptoKeyFormat format,
141 const blink::WebCryptoKey& key,
142 std::vector<uint8_t>* buffer) const {
143 switch (format) {
144 case blink::WebCryptoKeyFormatRaw:
145 return ExportKeyRaw(key, buffer);
146 case blink::WebCryptoKeyFormatSpki:
147 return ExportKeySpki(key, buffer);
148 case blink::WebCryptoKeyFormatPkcs8:
149 return ExportKeyPkcs8(key, buffer);
150 case blink::WebCryptoKeyFormatJwk:
151 return ExportKeyJwk(key, buffer);
152 default:
153 return Status::ErrorUnsupported();
157 Status AlgorithmImplementation::ExportKeyRaw(
158 const blink::WebCryptoKey& key,
159 std::vector<uint8_t>* buffer) const {
160 return Status::ErrorUnsupportedExportKeyFormat();
163 Status AlgorithmImplementation::ExportKeyPkcs8(
164 const blink::WebCryptoKey& key,
165 std::vector<uint8_t>* buffer) const {
166 return Status::ErrorUnsupportedExportKeyFormat();
169 Status AlgorithmImplementation::ExportKeySpki(
170 const blink::WebCryptoKey& key,
171 std::vector<uint8_t>* buffer) const {
172 return Status::ErrorUnsupportedExportKeyFormat();
175 Status AlgorithmImplementation::ExportKeyJwk(
176 const blink::WebCryptoKey& key,
177 std::vector<uint8_t>* buffer) const {
178 return Status::ErrorUnsupportedExportKeyFormat();
181 Status AlgorithmImplementation::SerializeKeyForClone(
182 const blink::WebCryptoKey& key,
183 blink::WebVector<uint8_t>* key_data) const {
184 return Status::ErrorUnsupported();
187 Status AlgorithmImplementation::DeserializeKeyForClone(
188 const blink::WebCryptoKeyAlgorithm& algorithm,
189 blink::WebCryptoKeyType type,
190 bool extractable,
191 blink::WebCryptoKeyUsageMask usages,
192 const CryptoData& key_data,
193 blink::WebCryptoKey* key) const {
194 return Status::ErrorUnsupported();
197 } // namespace webcrypto