| 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 247 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 258 // Creates a WebCryptoAlgorithm without any parameters. | 258 // Creates a WebCryptoAlgorithm without any parameters. |
| 259 CONTENT_EXPORT blink::WebCryptoAlgorithm CreateAlgorithm( | 259 CONTENT_EXPORT blink::WebCryptoAlgorithm CreateAlgorithm( |
| 260 blink::WebCryptoAlgorithmId id); | 260 blink::WebCryptoAlgorithmId id); |
| 261 | 261 |
| 262 // Creates an HMAC import algorithm whose inner hash algorithm is determined by | 262 // Creates an HMAC import algorithm whose inner hash algorithm is determined by |
| 263 // the specified algorithm ID. It is an error to call this method with a hash | 263 // the specified algorithm ID. It is an error to call this method with a hash |
| 264 // algorithm that is not SHA*. | 264 // algorithm that is not SHA*. |
| 265 CONTENT_EXPORT blink::WebCryptoAlgorithm CreateHmacImportAlgorithm( | 265 CONTENT_EXPORT blink::WebCryptoAlgorithm CreateHmacImportAlgorithm( |
| 266 blink::WebCryptoAlgorithmId hash_id); | 266 blink::WebCryptoAlgorithmId hash_id); |
| 267 | 267 |
| 268 // Creates an import algorithm for RSA algorithms that take a hash. |
| 269 // It is an error to call this with a hash_id that is not a SHA*. |
| 270 CONTENT_EXPORT blink::WebCryptoAlgorithm CreateRsaHashedImportAlgorithm( |
| 271 blink::WebCryptoAlgorithmId id, |
| 272 blink::WebCryptoAlgorithmId hash_id); |
| 273 |
| 274 // TODO(eroman): Move these to jwk.cc |
| 268 // Creates an RSASSA-PKCS1-v1_5 algorithm. It is an error to call this with a | 275 // Creates an RSASSA-PKCS1-v1_5 algorithm. It is an error to call this with a |
| 269 // hash_id that is not a SHA*. | 276 // hash_id that is not a SHA*. |
| 270 blink::WebCryptoAlgorithm CreateRsaSsaImportAlgorithm( | 277 blink::WebCryptoAlgorithm CreateRsaSsaImportAlgorithm( |
| 271 blink::WebCryptoAlgorithmId hash_id); | 278 blink::WebCryptoAlgorithmId hash_id); |
| 272 | 279 |
| 273 // Creates an RSA-OAEP algorithm. It is an error to call this with a hash_id | 280 // Creates an RSA-OAEP algorithm. It is an error to call this with a hash_id |
| 274 // that is not a SHA*. | 281 // that is not a SHA*. |
| 275 blink::WebCryptoAlgorithm CreateRsaOaepImportAlgorithm( | 282 blink::WebCryptoAlgorithm CreateRsaOaepImportAlgorithm( |
| 276 blink::WebCryptoAlgorithmId hash_id); | 283 blink::WebCryptoAlgorithmId hash_id); |
| 277 | 284 |
| 278 // TODO(eroman): Move to shared_crypto.cc | 285 // TODO(eroman): Move to shared_crypto.cc |
| 279 // Returns the internal block size for SHA-* | 286 // Returns the internal block size for SHA-* |
| 280 unsigned int ShaBlockSizeBytes(blink::WebCryptoAlgorithmId hash_id); | 287 unsigned int ShaBlockSizeBytes(blink::WebCryptoAlgorithmId hash_id); |
| 281 | 288 |
| 282 bool CreateSecretKeyAlgorithm(const blink::WebCryptoAlgorithm& algorithm, | 289 bool CreateSecretKeyAlgorithm(const blink::WebCryptoAlgorithm& algorithm, |
| 283 unsigned keylen_bytes, | 290 unsigned keylen_bytes, |
| 284 blink::WebCryptoKeyAlgorithm* key_algorithm); | 291 blink::WebCryptoKeyAlgorithm* key_algorithm); |
| 285 | 292 |
| 286 } // namespace webcrypto | 293 } // namespace webcrypto |
| 287 | 294 |
| 288 } // namespace content | 295 } // namespace content |
| 289 | 296 |
| 290 #endif // CONTENT_CHILD_WEBCRYPTO_WEBCRYPTO_UTIL_H_ | 297 #endif // CONTENT_CHILD_WEBCRYPTO_WEBCRYPTO_UTIL_H_ |
| OLD | NEW |