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

Side by Side Diff: content/child/webcrypto/algorithm_dispatch.h

Issue 512023002: Refactor the interface for generating keys. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 6 years, 3 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
« no previous file with comments | « no previous file | content/child/webcrypto/algorithm_dispatch.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2014 The Chromium Authors. All rights reserved. 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 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #ifndef CONTENT_CHILD_WEBCRYPTO_ALGORITHM_DISPATCH_H_ 5 #ifndef CONTENT_CHILD_WEBCRYPTO_ALGORITHM_DISPATCH_H_
6 #define CONTENT_CHILD_WEBCRYPTO_ALGORITHM_DISPATCH_H_ 6 #define CONTENT_CHILD_WEBCRYPTO_ALGORITHM_DISPATCH_H_
7 7
8 #include <stdint.h> 8 #include <stdint.h>
9 #include <vector> 9 #include <vector>
10 10
(...skipping 24 matching lines...) Expand all
35 35
36 CONTENT_EXPORT Status Decrypt(const blink::WebCryptoAlgorithm& algorithm, 36 CONTENT_EXPORT Status Decrypt(const blink::WebCryptoAlgorithm& algorithm,
37 const blink::WebCryptoKey& key, 37 const blink::WebCryptoKey& key,
38 const CryptoData& data, 38 const CryptoData& data,
39 std::vector<uint8_t>* buffer); 39 std::vector<uint8_t>* buffer);
40 40
41 CONTENT_EXPORT Status Digest(const blink::WebCryptoAlgorithm& algorithm, 41 CONTENT_EXPORT Status Digest(const blink::WebCryptoAlgorithm& algorithm,
42 const CryptoData& data, 42 const CryptoData& data,
43 std::vector<uint8_t>* buffer); 43 std::vector<uint8_t>* buffer);
44 44
45 CONTENT_EXPORT Status 45 // GenerateKey() has two modes of operation:
46 GenerateSecretKey(const blink::WebCryptoAlgorithm& algorithm, 46 // (1) If the algorithm is symmetric, a single secret key is generated and
47 bool extractable, 47 // written into |*private_key|.
48 blink::WebCryptoKeyUsageMask usage_mask, 48 // (2) If the algorithm is asymmetric, a key pair is generated and written to
49 blink::WebCryptoKey* key); 49 // |*public_key|, and |*private_key|.
50 50 CONTENT_EXPORT Status GenerateKey(const blink::WebCryptoAlgorithm& algorithm,
51 CONTENT_EXPORT Status 51 bool extractable,
52 GenerateKeyPair(const blink::WebCryptoAlgorithm& algorithm, 52 blink::WebCryptoKeyUsageMask usage_mask,
53 bool extractable, 53 blink::WebCryptoKey* public_key,
54 blink::WebCryptoKeyUsageMask usage_mask, 54 blink::WebCryptoKey* private_key);
Ryan Sleevi 2014/08/28 00:35:33 From an API level, this feels wrong. I liked your
eroman 2014/08/28 14:34:19 Would you prefer: (1) Keep the algorithm_dispatc
Ryan Sleevi 2014/08/28 21:15:04 To be clearer/explicit, I dislike the union of bot
55 blink::WebCryptoKey* public_key,
56 blink::WebCryptoKey* private_key);
57 55
58 CONTENT_EXPORT Status ImportKey(blink::WebCryptoKeyFormat format, 56 CONTENT_EXPORT Status ImportKey(blink::WebCryptoKeyFormat format,
59 const CryptoData& key_data, 57 const CryptoData& key_data,
60 const blink::WebCryptoAlgorithm& algorithm, 58 const blink::WebCryptoAlgorithm& algorithm,
61 bool extractable, 59 bool extractable,
62 blink::WebCryptoKeyUsageMask usage_mask, 60 blink::WebCryptoKeyUsageMask usage_mask,
63 blink::WebCryptoKey* key); 61 blink::WebCryptoKey* key);
64 62
65 CONTENT_EXPORT Status ExportKey(blink::WebCryptoKeyFormat format, 63 CONTENT_EXPORT Status ExportKey(blink::WebCryptoKeyFormat format,
66 const blink::WebCryptoKey& key, 64 const blink::WebCryptoKey& key,
(...skipping 28 matching lines...) Expand all
95 blink::WebCryptoKey* key); 93 blink::WebCryptoKey* key);
96 94
97 CONTENT_EXPORT scoped_ptr<blink::WebCryptoDigestor> CreateDigestor( 95 CONTENT_EXPORT scoped_ptr<blink::WebCryptoDigestor> CreateDigestor(
98 blink::WebCryptoAlgorithmId algorithm); 96 blink::WebCryptoAlgorithmId algorithm);
99 97
100 } // namespace webcrypto 98 } // namespace webcrypto
101 99
102 } // namespace content 100 } // namespace content
103 101
104 #endif // CONTENT_CHILD_WEBCRYPTO_ALGORITHM_DISPATCH_H_ 102 #endif // CONTENT_CHILD_WEBCRYPTO_ALGORITHM_DISPATCH_H_
OLDNEW
« no previous file with comments | « no previous file | content/child/webcrypto/algorithm_dispatch.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698