| 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 COMPONENTS_WEBCRYPTO_STATUS_H_ | 5 #ifndef COMPONENTS_WEBCRYPTO_STATUS_H_ |
| 6 #define COMPONENTS_WEBCRYPTO_STATUS_H_ | 6 #define COMPONENTS_WEBCRYPTO_STATUS_H_ |
| 7 | 7 |
| 8 #include <stddef.h> | 8 #include <stddef.h> |
| 9 | 9 |
| 10 #include <string> | 10 #include <string> |
| (...skipping 255 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 266 | 266 |
| 267 // No length parameter was provided for PBKDF2's Derive Bits operation. | 267 // No length parameter was provided for PBKDF2's Derive Bits operation. |
| 268 static Status ErrorPbkdf2DeriveBitsLengthNotSpecified(); | 268 static Status ErrorPbkdf2DeriveBitsLengthNotSpecified(); |
| 269 | 269 |
| 270 // PBKDF2's deriveBits() was called with an unsupported length of 0. | 270 // PBKDF2's deriveBits() was called with an unsupported length of 0. |
| 271 static Status ErrorPbkdf2DeriveBitsLengthZero(); | 271 static Status ErrorPbkdf2DeriveBitsLengthZero(); |
| 272 | 272 |
| 273 // PBKDF2 was called with iterations == 0. | 273 // PBKDF2 was called with iterations == 0. |
| 274 static Status ErrorPbkdf2Iterations0(); | 274 static Status ErrorPbkdf2Iterations0(); |
| 275 | 275 |
| 276 // Tried importing a key with extractable=true for one of the *KDF |
| 277 // algorithms. |
| 278 static Status ErrorImportExtractableKdfKey(); |
| 279 |
| 276 private: | 280 private: |
| 277 enum Type { TYPE_ERROR, TYPE_SUCCESS }; | 281 enum Type { TYPE_ERROR, TYPE_SUCCESS }; |
| 278 | 282 |
| 279 // Constructs an error with the specified error type and message. | 283 // Constructs an error with the specified error type and message. |
| 280 Status(blink::WebCryptoErrorType error_type, | 284 Status(blink::WebCryptoErrorType error_type, |
| 281 const std::string& error_details_utf8); | 285 const std::string& error_details_utf8); |
| 282 | 286 |
| 283 // Constructs a success or error without any details. | 287 // Constructs a success or error without any details. |
| 284 explicit Status(Type type); | 288 explicit Status(Type type); |
| 285 | 289 |
| 286 Type type_; | 290 Type type_; |
| 287 blink::WebCryptoErrorType error_type_; | 291 blink::WebCryptoErrorType error_type_; |
| 288 std::string error_details_; | 292 std::string error_details_; |
| 289 }; | 293 }; |
| 290 | 294 |
| 291 } // namespace webcrypto | 295 } // namespace webcrypto |
| 292 | 296 |
| 293 #endif // COMPONENTS_WEBCRYPTO_STATUS_H_ | 297 #endif // COMPONENTS_WEBCRYPTO_STATUS_H_ |
| OLD | NEW |