Chromium Code Reviews| OLD | NEW |
|---|---|
| 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 Loading... | |
| 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 Loading... | |
| 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_ |
| OLD | NEW |