Removed data compression UMA from ProxyService
[chromium-blink-merge.git] / content / child / webcrypto / openssl / aes_key_openssl.h
blob6c6b5ff546b68b2e5366f088b723f5b5bf989917
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 CONTENT_CHILD_WEBCRYPTO_OPENSSL_AES_OPENSSL_H_
6 #define CONTENT_CHILD_WEBCRYPTO_OPENSSL_AES_OPENSSL_H_
8 #include "content/child/webcrypto/algorithm_implementation.h"
10 namespace content {
12 namespace webcrypto {
14 // Base class for AES algorithms that provides the implementation for key
15 // creation and export.
16 class AesAlgorithm : public AlgorithmImplementation {
17 public:
18 // |all_key_usages| is the set of all WebCrypto key usages that are
19 // allowed for imported or generated keys. |jwk_suffix| is the suffix
20 // used when constructing JWK names for the algorithm. For instance A128CBC
21 // is the JWK name for 128-bit AES-CBC. The |jwk_suffix| in this case would
22 // be "CBC".
23 AesAlgorithm(blink::WebCryptoKeyUsageMask all_key_usages,
24 const std::string& jwk_suffix);
26 // This is the same as the other AesAlgorithm constructor where
27 // |all_key_usages| is pre-filled to values for encryption/decryption
28 // algorithms (supports usages for: encrypt, decrypt, wrap, unwrap).
29 explicit AesAlgorithm(const std::string& jwk_suffix);
31 virtual Status VerifyKeyUsagesBeforeGenerateKey(
32 blink::WebCryptoKeyUsageMask usage_mask) const OVERRIDE;
34 virtual Status GenerateSecretKey(const blink::WebCryptoAlgorithm& algorithm,
35 bool extractable,
36 blink::WebCryptoKeyUsageMask usage_mask,
37 blink::WebCryptoKey* key) const OVERRIDE;
39 virtual Status VerifyKeyUsagesBeforeImportKey(
40 blink::WebCryptoKeyFormat format,
41 blink::WebCryptoKeyUsageMask usage_mask) const OVERRIDE;
43 virtual Status ImportKeyRaw(const CryptoData& key_data,
44 const blink::WebCryptoAlgorithm& algorithm,
45 bool extractable,
46 blink::WebCryptoKeyUsageMask usage_mask,
47 blink::WebCryptoKey* key) const OVERRIDE;
49 virtual Status ImportKeyJwk(const CryptoData& key_data,
50 const blink::WebCryptoAlgorithm& algorithm,
51 bool extractable,
52 blink::WebCryptoKeyUsageMask usage_mask,
53 blink::WebCryptoKey* key) const OVERRIDE;
55 virtual Status ExportKeyRaw(const blink::WebCryptoKey& key,
56 std::vector<uint8_t>* buffer) const OVERRIDE;
58 virtual Status ExportKeyJwk(const blink::WebCryptoKey& key,
59 std::vector<uint8_t>* buffer) const OVERRIDE;
61 private:
62 const blink::WebCryptoKeyUsageMask all_key_usages_;
63 const std::string jwk_suffix_;
66 } // namespace webcrypto
68 } // namespace content
70 #endif // CONTENT_CHILD_WEBCRYPTO_OPENSSL_AES_OPENSSL_H_