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 "content/child/webcrypto/algorithm_implementation.h"
7 #include "content/child/webcrypto/status.h"
13 AlgorithmImplementation::~AlgorithmImplementation() {
16 Status
AlgorithmImplementation::Encrypt(
17 const blink::WebCryptoAlgorithm
& algorithm
,
18 const blink::WebCryptoKey
& key
,
19 const CryptoData
& data
,
20 std::vector
<uint8_t>* buffer
) const {
21 return Status::ErrorUnsupported();
24 Status
AlgorithmImplementation::Decrypt(
25 const blink::WebCryptoAlgorithm
& algorithm
,
26 const blink::WebCryptoKey
& key
,
27 const CryptoData
& data
,
28 std::vector
<uint8_t>* buffer
) const {
29 return Status::ErrorUnsupported();
32 Status
AlgorithmImplementation::Sign(const blink::WebCryptoAlgorithm
& algorithm
,
33 const blink::WebCryptoKey
& key
,
34 const CryptoData
& data
,
35 std::vector
<uint8_t>* buffer
) const {
36 return Status::ErrorUnsupported();
39 Status
AlgorithmImplementation::Verify(
40 const blink::WebCryptoAlgorithm
& algorithm
,
41 const blink::WebCryptoKey
& key
,
42 const CryptoData
& signature
,
43 const CryptoData
& data
,
44 bool* signature_match
) const {
45 return Status::ErrorUnsupported();
48 Status
AlgorithmImplementation::Digest(
49 const blink::WebCryptoAlgorithm
& algorithm
,
50 const CryptoData
& data
,
51 std::vector
<uint8_t>* buffer
) const {
52 return Status::ErrorUnsupported();
55 Status
AlgorithmImplementation::VerifyKeyUsagesBeforeGenerateKey(
56 blink::WebCryptoKeyUsageMask usage_mask
) const {
57 return Status::ErrorUnsupported();
60 Status
AlgorithmImplementation::VerifyKeyUsagesBeforeGenerateKeyPair(
61 blink::WebCryptoKeyUsageMask usage_mask
,
62 blink::WebCryptoKeyUsageMask
* public_usage_mask
,
63 blink::WebCryptoKeyUsageMask
* private_usage_mask
) const {
64 *public_usage_mask
= *private_usage_mask
= 0;
65 return Status::ErrorUnsupported();
68 Status
AlgorithmImplementation::GenerateSecretKey(
69 const blink::WebCryptoAlgorithm
& algorithm
,
71 blink::WebCryptoKeyUsageMask usage_mask
,
72 blink::WebCryptoKey
* key
) const {
73 return Status::ErrorUnsupported();
76 Status
AlgorithmImplementation::GenerateKeyPair(
77 const blink::WebCryptoAlgorithm
& algorithm
,
79 blink::WebCryptoKeyUsageMask public_usage_mask
,
80 blink::WebCryptoKeyUsageMask private_usage_mask
,
81 blink::WebCryptoKey
* public_key
,
82 blink::WebCryptoKey
* private_key
) const {
83 return Status::ErrorUnsupported();
86 Status
AlgorithmImplementation::VerifyKeyUsagesBeforeImportKey(
87 blink::WebCryptoKeyFormat format
,
88 blink::WebCryptoKeyUsageMask usage_mask
) const {
89 return Status::ErrorUnsupportedImportKeyFormat();
92 Status
AlgorithmImplementation::ImportKeyRaw(
93 const CryptoData
& key_data
,
94 const blink::WebCryptoAlgorithm
& algorithm
,
96 blink::WebCryptoKeyUsageMask usage_mask
,
97 blink::WebCryptoKey
* key
) const {
98 return Status::ErrorUnsupportedImportKeyFormat();
101 Status
AlgorithmImplementation::ImportKeyPkcs8(
102 const CryptoData
& key_data
,
103 const blink::WebCryptoAlgorithm
& algorithm
,
105 blink::WebCryptoKeyUsageMask usage_mask
,
106 blink::WebCryptoKey
* key
) const {
107 return Status::ErrorUnsupportedImportKeyFormat();
110 Status
AlgorithmImplementation::ImportKeySpki(
111 const CryptoData
& key_data
,
112 const blink::WebCryptoAlgorithm
& algorithm
,
114 blink::WebCryptoKeyUsageMask usage_mask
,
115 blink::WebCryptoKey
* key
) const {
116 return Status::ErrorUnsupportedImportKeyFormat();
119 Status
AlgorithmImplementation::ImportKeyJwk(
120 const CryptoData
& key_data
,
121 const blink::WebCryptoAlgorithm
& algorithm
,
123 blink::WebCryptoKeyUsageMask usage_mask
,
124 blink::WebCryptoKey
* key
) const {
125 return Status::ErrorUnsupportedImportKeyFormat();
128 Status
AlgorithmImplementation::ExportKeyRaw(
129 const blink::WebCryptoKey
& key
,
130 std::vector
<uint8_t>* buffer
) const {
131 return Status::ErrorUnsupportedExportKeyFormat();
134 Status
AlgorithmImplementation::ExportKeyPkcs8(
135 const blink::WebCryptoKey
& key
,
136 std::vector
<uint8_t>* buffer
) const {
137 return Status::ErrorUnsupportedExportKeyFormat();
140 Status
AlgorithmImplementation::ExportKeySpki(
141 const blink::WebCryptoKey
& key
,
142 std::vector
<uint8_t>* buffer
) const {
143 return Status::ErrorUnsupportedExportKeyFormat();
146 Status
AlgorithmImplementation::ExportKeyJwk(
147 const blink::WebCryptoKey
& key
,
148 std::vector
<uint8_t>* buffer
) const {
149 return Status::ErrorUnsupportedExportKeyFormat();
152 } // namespace webcrypto
154 } // namespace content