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_TEST_TEST_HELPERS_H_ | 5 #ifndef CONTENT_CHILD_WEBCRYPTO_TEST_TEST_HELPERS_H_ |
6 #define CONTENT_CHILD_WEBCRYPTO_TEST_TEST_HELPERS_H_ | 6 #define CONTENT_CHILD_WEBCRYPTO_TEST_TEST_HELPERS_H_ |
7 | 7 |
8 #include <ostream> | 8 #include <ostream> |
9 #include <string> | 9 #include <string> |
10 #include <vector> | 10 #include <vector> |
(...skipping 152 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
163 const std::string& e_expected_hex, | 163 const std::string& e_expected_hex, |
164 blink::WebCryptoKeyUsageMask use_mask_expected); | 164 blink::WebCryptoKeyUsageMask use_mask_expected); |
165 | 165 |
166 // Helper that tests importing ane exporting of symmetric keys as JWK. | 166 // Helper that tests importing ane exporting of symmetric keys as JWK. |
167 void ImportExportJwkSymmetricKey( | 167 void ImportExportJwkSymmetricKey( |
168 int key_len_bits, | 168 int key_len_bits, |
169 const blink::WebCryptoAlgorithm& import_algorithm, | 169 const blink::WebCryptoAlgorithm& import_algorithm, |
170 blink::WebCryptoKeyUsageMask usages, | 170 blink::WebCryptoKeyUsageMask usages, |
171 const std::string& jwk_alg); | 171 const std::string& jwk_alg); |
172 | 172 |
| 173 // Wrappers around GenerateKey() which expect the result to be either a secret |
| 174 // key or a public/private keypair. If the result does not match the |
| 175 // expectation, then it fails with Status::ErrorUnexpected(). |
| 176 Status GenerateSecretKey(const blink::WebCryptoAlgorithm& algorithm, |
| 177 bool extractable, |
| 178 blink::WebCryptoKeyUsageMask usage_mask, |
| 179 blink::WebCryptoKey* key); |
| 180 Status GenerateKeyPair(const blink::WebCryptoAlgorithm& algorithm, |
| 181 bool extractable, |
| 182 blink::WebCryptoKeyUsageMask usage_mask, |
| 183 blink::WebCryptoKey* public_key, |
| 184 blink::WebCryptoKey* private_key); |
| 185 |
173 } // namespace webcrypto | 186 } // namespace webcrypto |
174 | 187 |
175 } // namesapce content | 188 } // namesapce content |
176 | 189 |
177 #endif // CONTENT_CHILD_WEBCRYPTO_TEST_TEST_HELPERS_H_ | 190 #endif // CONTENT_CHILD_WEBCRYPTO_TEST_TEST_HELPERS_H_ |
OLD | NEW |