ExtensionInstallDialogView: fix scrolling behavior on Views (Win,Linux)
[chromium-blink-merge.git] / components / webcrypto / openssl / aes_algorithm_openssl.h
blobfd87bacd0ec399ee03bff576332263bfec786166
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 #ifndef COMPONENTS_WEBCRYPTO_OPENSSL_AES_ALGORITHM_OPENSSL_H_
6 #define COMPONENTS_WEBCRYPTO_OPENSSL_AES_ALGORITHM_OPENSSL_H_
8 #include "components/webcrypto/algorithm_implementation.h"
10 namespace webcrypto {
12 // Base class for AES algorithms that provides the implementation for key
13 // creation and export.
14 class AesAlgorithm : public AlgorithmImplementation {
15 public:
16 // |all_key_usages| is the set of all WebCrypto key usages that are
17 // allowed for imported or generated keys. |jwk_suffix| is the suffix
18 // used when constructing JWK names for the algorithm. For instance A128CBC
19 // is the JWK name for 128-bit AES-CBC. The |jwk_suffix| in this case would
20 // be "CBC".
21 AesAlgorithm(blink::WebCryptoKeyUsageMask all_key_usages,
22 const std::string& jwk_suffix);
24 // This is the same as the other AesAlgorithm constructor where
25 // |all_key_usages| is pre-filled to values for encryption/decryption
26 // algorithms (supports usages for: encrypt, decrypt, wrap, unwrap).
27 explicit AesAlgorithm(const std::string& jwk_suffix);
29 Status GenerateKey(const blink::WebCryptoAlgorithm& algorithm,
30 bool extractable,
31 blink::WebCryptoKeyUsageMask usages,
32 GenerateKeyResult* result) const override;
34 Status VerifyKeyUsagesBeforeImportKey(
35 blink::WebCryptoKeyFormat format,
36 blink::WebCryptoKeyUsageMask usages) const override;
38 Status ImportKeyRaw(const CryptoData& key_data,
39 const blink::WebCryptoAlgorithm& algorithm,
40 bool extractable,
41 blink::WebCryptoKeyUsageMask usages,
42 blink::WebCryptoKey* key) const override;
44 Status ImportKeyJwk(const CryptoData& key_data,
45 const blink::WebCryptoAlgorithm& algorithm,
46 bool extractable,
47 blink::WebCryptoKeyUsageMask usages,
48 blink::WebCryptoKey* key) const override;
50 Status ExportKeyRaw(const blink::WebCryptoKey& key,
51 std::vector<uint8_t>* buffer) const override;
53 Status ExportKeyJwk(const blink::WebCryptoKey& key,
54 std::vector<uint8_t>* buffer) const override;
56 Status SerializeKeyForClone(
57 const blink::WebCryptoKey& key,
58 blink::WebVector<uint8_t>* key_data) const override;
60 Status DeserializeKeyForClone(const blink::WebCryptoKeyAlgorithm& algorithm,
61 blink::WebCryptoKeyType type,
62 bool extractable,
63 blink::WebCryptoKeyUsageMask usages,
64 const CryptoData& key_data,
65 blink::WebCryptoKey* key) const override;
67 Status GetKeyLength(const blink::WebCryptoAlgorithm& key_length_algorithm,
68 bool* has_length_bits,
69 unsigned int* length_bits) const override;
71 private:
72 const blink::WebCryptoKeyUsageMask all_key_usages_;
73 const std::string jwk_suffix_;
76 } // namespace webcrypto
78 #endif // COMPONENTS_WEBCRYPTO_OPENSSL_AES_ALGORITHM_OPENSSL_H_