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_WEBCRYPTO_UTIL_H_ | 5 #ifndef CONTENT_CHILD_WEBCRYPTO_WEBCRYPTO_UTIL_H_ |
6 #define CONTENT_CHILD_WEBCRYPTO_WEBCRYPTO_UTIL_H_ | 6 #define CONTENT_CHILD_WEBCRYPTO_WEBCRYPTO_UTIL_H_ |
7 | 7 |
8 #include <string> | 8 #include <string> |
9 #include <vector> | 9 #include <vector> |
10 #include "base/basictypes.h" | 10 #include "base/basictypes.h" |
(...skipping 219 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
230 // Creates a WebCryptoAlgorithm without any parameters. | 230 // Creates a WebCryptoAlgorithm without any parameters. |
231 CONTENT_EXPORT blink::WebCryptoAlgorithm CreateAlgorithm( | 231 CONTENT_EXPORT blink::WebCryptoAlgorithm CreateAlgorithm( |
232 blink::WebCryptoAlgorithmId id); | 232 blink::WebCryptoAlgorithmId id); |
233 | 233 |
234 // Creates an HMAC import algorithm whose inner hash algorithm is determined by | 234 // Creates an HMAC import algorithm whose inner hash algorithm is determined by |
235 // the specified algorithm ID. It is an error to call this method with a hash | 235 // the specified algorithm ID. It is an error to call this method with a hash |
236 // algorithm that is not SHA*. | 236 // algorithm that is not SHA*. |
237 CONTENT_EXPORT blink::WebCryptoAlgorithm CreateHmacImportAlgorithm( | 237 CONTENT_EXPORT blink::WebCryptoAlgorithm CreateHmacImportAlgorithm( |
238 blink::WebCryptoAlgorithmId hash_id); | 238 blink::WebCryptoAlgorithmId hash_id); |
239 | 239 |
| 240 // Creates an import algorithm for RSA algorithms that take a hash. |
| 241 // It is an error to call this with a hash_id that is not a SHA*. |
| 242 CONTENT_EXPORT blink::WebCryptoAlgorithm CreateRsaHashedImportAlgorithm( |
| 243 blink::WebCryptoAlgorithmId id, |
| 244 blink::WebCryptoAlgorithmId hash_id); |
| 245 |
| 246 // TODO(eroman): Move these to jwk.cc |
240 // Creates an RSASSA-PKCS1-v1_5 algorithm. It is an error to call this with a | 247 // Creates an RSASSA-PKCS1-v1_5 algorithm. It is an error to call this with a |
241 // hash_id that is not a SHA*. | 248 // hash_id that is not a SHA*. |
242 blink::WebCryptoAlgorithm CreateRsaSsaImportAlgorithm( | 249 blink::WebCryptoAlgorithm CreateRsaSsaImportAlgorithm( |
243 blink::WebCryptoAlgorithmId hash_id); | 250 blink::WebCryptoAlgorithmId hash_id); |
244 | 251 |
245 // Creates an RSA-OAEP algorithm. It is an error to call this with a hash_id | 252 // Creates an RSA-OAEP algorithm. It is an error to call this with a hash_id |
246 // that is not a SHA*. | 253 // that is not a SHA*. |
247 blink::WebCryptoAlgorithm CreateRsaOaepImportAlgorithm( | 254 blink::WebCryptoAlgorithm CreateRsaOaepImportAlgorithm( |
248 blink::WebCryptoAlgorithmId hash_id); | 255 blink::WebCryptoAlgorithmId hash_id); |
249 | 256 |
250 // TODO(eroman): Move to shared_crypto.cc | 257 // TODO(eroman): Move to shared_crypto.cc |
251 // Returns the internal block size for SHA-* | 258 // Returns the internal block size for SHA-* |
252 unsigned int ShaBlockSizeBytes(blink::WebCryptoAlgorithmId hash_id); | 259 unsigned int ShaBlockSizeBytes(blink::WebCryptoAlgorithmId hash_id); |
253 | 260 |
254 bool CreateSecretKeyAlgorithm(const blink::WebCryptoAlgorithm& algorithm, | 261 bool CreateSecretKeyAlgorithm(const blink::WebCryptoAlgorithm& algorithm, |
255 unsigned keylen_bytes, | 262 unsigned keylen_bytes, |
256 blink::WebCryptoKeyAlgorithm* key_algorithm); | 263 blink::WebCryptoKeyAlgorithm* key_algorithm); |
257 | 264 |
258 } // namespace webcrypto | 265 } // namespace webcrypto |
259 | 266 |
260 } // namespace content | 267 } // namespace content |
261 | 268 |
262 #endif // CONTENT_CHILD_WEBCRYPTO_WEBCRYPTO_UTIL_H_ | 269 #endif // CONTENT_CHILD_WEBCRYPTO_WEBCRYPTO_UTIL_H_ |
OLD | NEW |