Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1)

Side by Side Diff: content/child/webcrypto/nss/aes_key_nss.h

Issue 379383002: Refactor WebCrypto code (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: rebase onto master Created 6 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
(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_implementation.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 std::string& jwk_suffix);
Ryan Sleevi 2014/07/17 00:06:54 Document what these parameters mean. jwk_suffix in
eroman 2014/07/17 20:37:25 Done. Documented as: // Constructs an AES algor
24
25 // Shortcut for creating an encryption algorithm, with support for encrypt,
26 // decrypt, wrap, unwrap.
27 AesAlgorithm(CK_MECHANISM_TYPE import_mechanism,
28 const std::string& jwk_suffix);
Ryan Sleevi 2014/07/17 00:06:54 document the other parameters.
eroman 2014/07/17 20:37:25 Done. Documented as: // This is the same as oth
29
30 virtual Status VerifyKeyUsagesBeforeGenerateKey(
31 blink::WebCryptoKeyUsageMask usage_mask) const OVERRIDE;
32
33 virtual Status GenerateSecretKey(const blink::WebCryptoAlgorithm& algorithm,
34 bool extractable,
35 blink::WebCryptoKeyUsageMask usage_mask,
36 blink::WebCryptoKey* key) const OVERRIDE;
37
38 virtual Status VerifyKeyUsagesBeforeImportKey(
39 blink::WebCryptoKeyFormat format,
40 blink::WebCryptoKeyUsageMask usage_mask) const OVERRIDE;
41
42 virtual Status ImportKeyRaw(const CryptoData& key_data,
43 const blink::WebCryptoAlgorithm& algorithm,
44 bool extractable,
45 blink::WebCryptoKeyUsageMask usage_mask,
46 blink::WebCryptoKey* key) const OVERRIDE;
47
48 virtual Status ImportKeyJwk(const CryptoData& key_data,
49 const blink::WebCryptoAlgorithm& algorithm,
50 bool extractable,
51 blink::WebCryptoKeyUsageMask usage_mask,
52 blink::WebCryptoKey* key) const OVERRIDE;
53
54 virtual Status ExportKeyRaw(const blink::WebCryptoKey& key,
55 std::vector<uint8>* buffer) const OVERRIDE;
56
57 virtual Status ExportKeyJwk(const blink::WebCryptoKey& key,
58 std::vector<uint8>* buffer) const OVERRIDE;
59
60 private:
61 const CK_MECHANISM_TYPE import_mechanism_;
62 const CK_FLAGS import_flags_;
63 const blink::WebCryptoKeyUsageMask all_key_usages_;
64 const std::string jwk_suffix_;
65 };
66
67 } // namespace webcrypto
68
69 } // namespace content
70
71 #endif // CONTENT_CHILD_WEBCRYPTO_NSS_AES_NSS_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698