OLD | NEW |
(Empty) | |
| 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 #ifndef CONTENT_CHILD_WEBCRYPTO_OPENSSL_AES_OPENSSL_H_ |
| 6 #define CONTENT_CHILD_WEBCRYPTO_OPENSSL_AES_OPENSSL_H_ |
| 7 |
| 8 #include "content/child/webcrypto/algorithm.h" |
| 9 |
| 10 namespace content { |
| 11 |
| 12 namespace webcrypto { |
| 13 |
| 14 // Base class for AES algorithms that provides the implementation for key |
| 15 // creation and export. |
| 16 class AesAlgorithm : public AlgorithmImplementation { |
| 17 public: |
| 18 AesAlgorithm(blink::WebCryptoKeyUsageMask all_key_usages, |
| 19 const char* jwk_suffix); |
| 20 |
| 21 // Shortcut for creating an encryption algorithm, with support for encrypt, |
| 22 // decrypt, wrap, unwrap. |
| 23 explicit AesAlgorithm(const char* jwk_suffix); |
| 24 |
| 25 virtual Status GenerateSecretKey(const blink::WebCryptoAlgorithm& algorithm, |
| 26 bool extractable, |
| 27 blink::WebCryptoKeyUsageMask usage_mask, |
| 28 blink::WebCryptoKey* key) const OVERRIDE; |
| 29 |
| 30 virtual Status VerifyKeyUsagesBeforeImportKey( |
| 31 blink::WebCryptoKeyFormat format, |
| 32 blink::WebCryptoKeyUsageMask usage_mask) const OVERRIDE; |
| 33 |
| 34 virtual Status VerifyKeyUsagesBeforeGenerateKey( |
| 35 blink::WebCryptoKeyUsageMask usage_mask) const OVERRIDE; |
| 36 |
| 37 virtual Status ImportKeyRaw(const CryptoData& key_data, |
| 38 const blink::WebCryptoAlgorithm& algorithm, |
| 39 bool extractable, |
| 40 blink::WebCryptoKeyUsageMask usage_mask, |
| 41 blink::WebCryptoKey* key) const OVERRIDE; |
| 42 |
| 43 virtual Status ImportKeyJwk(const CryptoData& key_data, |
| 44 const blink::WebCryptoAlgorithm& algorithm, |
| 45 bool extractable, |
| 46 blink::WebCryptoKeyUsageMask usage_mask, |
| 47 blink::WebCryptoKey* key) const OVERRIDE; |
| 48 |
| 49 virtual Status ExportKeyRaw(const blink::WebCryptoKey& key, |
| 50 std::vector<uint8>* buffer) const OVERRIDE; |
| 51 |
| 52 virtual Status ExportKeyJwk(const blink::WebCryptoKey& key, |
| 53 std::vector<uint8>* buffer) const OVERRIDE; |
| 54 |
| 55 private: |
| 56 const blink::WebCryptoKeyUsageMask all_key_usages_; |
| 57 const char* const jwk_suffix_; |
| 58 }; |
| 59 |
| 60 } // namespace webcrypto |
| 61 |
| 62 } // namespace content |
| 63 |
| 64 #endif // CONTENT_CHILD_WEBCRYPTO_OPENSSL_AES_OPENSSL_H_ |
OLD | NEW |