Home | History | Annotate | Download | only in webcrypto
      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 "content/child/webcrypto/algorithm_implementation.h"
      6 
      7 #include "content/child/webcrypto/status.h"
      8 
      9 namespace content {
     10 
     11 namespace webcrypto {
     12 
     13 AlgorithmImplementation::~AlgorithmImplementation() {
     14 }
     15 
     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();
     22 }
     23 
     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();
     30 }
     31 
     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();
     37 }
     38 
     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();
     46 }
     47 
     48 Status AlgorithmImplementation::Digest(
     49     const blink::WebCryptoAlgorithm& algorithm,
     50     const CryptoData& data,
     51     std::vector<uint8_t>* buffer) const {
     52   return Status::ErrorUnsupported();
     53 }
     54 
     55 Status AlgorithmImplementation::VerifyKeyUsagesBeforeGenerateKey(
     56     blink::WebCryptoKeyUsageMask usage_mask) const {
     57   return Status::ErrorUnsupported();
     58 }
     59 
     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();
     66 }
     67 
     68 Status AlgorithmImplementation::GenerateSecretKey(
     69     const blink::WebCryptoAlgorithm& algorithm,
     70     bool extractable,
     71     blink::WebCryptoKeyUsageMask usage_mask,
     72     blink::WebCryptoKey* key) const {
     73   return Status::ErrorUnsupported();
     74 }
     75 
     76 Status AlgorithmImplementation::GenerateKeyPair(
     77     const blink::WebCryptoAlgorithm& algorithm,
     78     bool extractable,
     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();
     84 }
     85 
     86 Status AlgorithmImplementation::VerifyKeyUsagesBeforeImportKey(
     87     blink::WebCryptoKeyFormat format,
     88     blink::WebCryptoKeyUsageMask usage_mask) const {
     89   return Status::ErrorUnsupportedImportKeyFormat();
     90 }
     91 
     92 Status AlgorithmImplementation::ImportKeyRaw(
     93     const CryptoData& key_data,
     94     const blink::WebCryptoAlgorithm& algorithm,
     95     bool extractable,
     96     blink::WebCryptoKeyUsageMask usage_mask,
     97     blink::WebCryptoKey* key) const {
     98   return Status::ErrorUnsupportedImportKeyFormat();
     99 }
    100 
    101 Status AlgorithmImplementation::ImportKeyPkcs8(
    102     const CryptoData& key_data,
    103     const blink::WebCryptoAlgorithm& algorithm,
    104     bool extractable,
    105     blink::WebCryptoKeyUsageMask usage_mask,
    106     blink::WebCryptoKey* key) const {
    107   return Status::ErrorUnsupportedImportKeyFormat();
    108 }
    109 
    110 Status AlgorithmImplementation::ImportKeySpki(
    111     const CryptoData& key_data,
    112     const blink::WebCryptoAlgorithm& algorithm,
    113     bool extractable,
    114     blink::WebCryptoKeyUsageMask usage_mask,
    115     blink::WebCryptoKey* key) const {
    116   return Status::ErrorUnsupportedImportKeyFormat();
    117 }
    118 
    119 Status AlgorithmImplementation::ImportKeyJwk(
    120     const CryptoData& key_data,
    121     const blink::WebCryptoAlgorithm& algorithm,
    122     bool extractable,
    123     blink::WebCryptoKeyUsageMask usage_mask,
    124     blink::WebCryptoKey* key) const {
    125   return Status::ErrorUnsupportedImportKeyFormat();
    126 }
    127 
    128 Status AlgorithmImplementation::ExportKeyRaw(
    129     const blink::WebCryptoKey& key,
    130     std::vector<uint8_t>* buffer) const {
    131   return Status::ErrorUnsupportedExportKeyFormat();
    132 }
    133 
    134 Status AlgorithmImplementation::ExportKeyPkcs8(
    135     const blink::WebCryptoKey& key,
    136     std::vector<uint8_t>* buffer) const {
    137   return Status::ErrorUnsupportedExportKeyFormat();
    138 }
    139 
    140 Status AlgorithmImplementation::ExportKeySpki(
    141     const blink::WebCryptoKey& key,
    142     std::vector<uint8_t>* buffer) const {
    143   return Status::ErrorUnsupportedExportKeyFormat();
    144 }
    145 
    146 Status AlgorithmImplementation::ExportKeyJwk(
    147     const blink::WebCryptoKey& key,
    148     std::vector<uint8_t>* buffer) const {
    149   return Status::ErrorUnsupportedExportKeyFormat();
    150 }
    151 
    152 }  // namespace webcrypto
    153 
    154 }  // namespace content
    155