Chromium Code Reviews| 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_NSS_AES_NSS_H_ | |
| 6 #define CONTENT_CHILD_WEBCRYPTO_NSS_AES_NSS_H_ | |
| 7 | |
| 8 #include <pkcs11t.h> | |
| 9 | |
| 10 #include "content/child/webcrypto/algorithm.h" | |
| 11 | |
| 12 namespace content { | |
| 13 | |
| 14 namespace webcrypto { | |
| 15 | |
| 16 // Base class for AES algorithms that provides the implementation for key | |
| 17 // creation and export. | |
| 18 class AesAlgorithm : public AlgorithmImplementation { | |
| 19 public: | |
| 20 AesAlgorithm(CK_MECHANISM_TYPE import_mechanism, | |
| 21 CK_FLAGS import_flags, | |
| 22 blink::WebCryptoKeyUsageMask all_key_usages, | |
| 23 const char* jwk_suffix); | |
| 24 | |
| 25 // Shortcut for creating an encryption algorithm, with support for encrypt, | |
| 26 // decrypt, wrap, unwrap. | |
| 27 AesAlgorithm(CK_MECHANISM_TYPE import_mechanism, const char* jwk_suffix); | |
|
Ryan Sleevi
2014/07/12 00:55:27
Is this really a suffix or a prefix? And what's th
eroman
2014/07/12 01:59:30
A128CBC --> "CBC" is the jwk_suffix expected here.
| |
| 28 | |
| 29 virtual Status GenerateSecretKey(const blink::WebCryptoAlgorithm& algorithm, | |
| 30 bool extractable, | |
| 31 blink::WebCryptoKeyUsageMask usage_mask, | |
| 32 blink::WebCryptoKey* key) const OVERRIDE; | |
| 33 | |
| 34 virtual Status VerifyKeyUsagesBeforeImportKey( | |
| 35 blink::WebCryptoKeyFormat format, | |
| 36 blink::WebCryptoKeyUsageMask usage_mask) const OVERRIDE; | |
|
Ryan Sleevi
2014/07/12 00:55:27
Please keep the ordering the same on all derived m
eroman
2014/07/12 01:59:30
Acknowledged.
| |
| 37 | |
| 38 virtual Status VerifyKeyUsagesBeforeGenerateKey( | |
| 39 blink::WebCryptoKeyUsageMask usage_mask) const OVERRIDE; | |
| 40 | |
| 41 virtual Status ImportKeyRaw(const CryptoData& key_data, | |
| 42 const blink::WebCryptoAlgorithm& algorithm, | |
| 43 bool extractable, | |
| 44 blink::WebCryptoKeyUsageMask usage_mask, | |
| 45 blink::WebCryptoKey* key) const OVERRIDE; | |
| 46 | |
| 47 virtual Status ImportKeyJwk(const CryptoData& key_data, | |
| 48 const blink::WebCryptoAlgorithm& algorithm, | |
| 49 bool extractable, | |
| 50 blink::WebCryptoKeyUsageMask usage_mask, | |
| 51 blink::WebCryptoKey* key) const OVERRIDE; | |
| 52 | |
| 53 virtual Status ExportKeyRaw(const blink::WebCryptoKey& key, | |
| 54 std::vector<uint8>* buffer) const OVERRIDE; | |
| 55 | |
| 56 virtual Status ExportKeyJwk(const blink::WebCryptoKey& key, | |
| 57 std::vector<uint8>* buffer) const OVERRIDE; | |
| 58 | |
| 59 private: | |
| 60 const CK_MECHANISM_TYPE import_mechanism_; | |
| 61 const CK_FLAGS import_flags_; | |
| 62 const blink::WebCryptoKeyUsageMask all_key_usages_; | |
| 63 const char* const jwk_suffix_; | |
| 64 }; | |
| 65 | |
| 66 } // namespace webcrypto | |
| 67 | |
| 68 } // namespace content | |
| 69 | |
| 70 #endif // CONTENT_CHILD_WEBCRYPTO_NSS_AES_NSS_H_ | |
| OLD | NEW |