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_STATUS_H_ | 5 #ifndef CONTENT_CHILD_WEBCRYPTO_STATUS_H_ |
6 #define CONTENT_CHILD_WEBCRYPTO_STATUS_H_ | 6 #define CONTENT_CHILD_WEBCRYPTO_STATUS_H_ |
7 | 7 |
8 #include <string> | 8 #include <string> |
9 #include "content/common/content_export.h" | 9 #include "content/common/content_export.h" |
10 #include "third_party/WebKit/public/platform/WebCrypto.h" | 10 #include "third_party/WebKit/public/platform/WebCrypto.h" |
(...skipping 195 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
206 | 206 |
207 // The key length specified when generating a key was invalid. Either it was | 207 // The key length specified when generating a key was invalid. Either it was |
208 // zero, or it was not a multiple of 8 bits. | 208 // zero, or it was not a multiple of 8 bits. |
209 static Status ErrorGenerateKeyLength(); | 209 static Status ErrorGenerateKeyLength(); |
210 | 210 |
211 // Attempted to create a key (either by importKey(), generateKey(), or | 211 // Attempted to create a key (either by importKey(), generateKey(), or |
212 // unwrapKey()) however the key usages were not applicable for the key type | 212 // unwrapKey()) however the key usages were not applicable for the key type |
213 // and algorithm. | 213 // and algorithm. |
214 static Status ErrorCreateKeyBadUsages(); | 214 static Status ErrorCreateKeyBadUsages(); |
215 | 215 |
| 216 // An EC key imported using SPKI/PKCS8 format had the wrong curve specified in |
| 217 // the key. |
| 218 static Status ErrorImportedEcKeyIncorrectCurve(); |
| 219 |
| 220 // The "crv" member for a JWK did not match the expectations from importKey() |
| 221 static Status ErrorJwkIncorrectCrv(); |
| 222 |
| 223 // The EC key failed validation (coordinates don't lie on curve, out of range, |
| 224 // etc.) |
| 225 static Status ErrorEcKeyInvalid(); |
| 226 |
216 private: | 227 private: |
217 enum Type { TYPE_ERROR, TYPE_SUCCESS }; | 228 enum Type { TYPE_ERROR, TYPE_SUCCESS }; |
218 | 229 |
219 // Constructs an error with the specified error type and message. | 230 // Constructs an error with the specified error type and message. |
220 Status(blink::WebCryptoErrorType error_type, | 231 Status(blink::WebCryptoErrorType error_type, |
221 const std::string& error_details_utf8); | 232 const std::string& error_details_utf8); |
222 | 233 |
223 // Constructs a success or error without any details. | 234 // Constructs a success or error without any details. |
224 explicit Status(Type type); | 235 explicit Status(Type type); |
225 | 236 |
226 Type type_; | 237 Type type_; |
227 blink::WebCryptoErrorType error_type_; | 238 blink::WebCryptoErrorType error_type_; |
228 std::string error_details_; | 239 std::string error_details_; |
229 }; | 240 }; |
230 | 241 |
231 } // namespace webcrypto | 242 } // namespace webcrypto |
232 | 243 |
233 } // namespace content | 244 } // namespace content |
234 | 245 |
235 #endif // CONTENT_CHILD_WEBCRYPTO_STATUS_H_ | 246 #endif // CONTENT_CHILD_WEBCRYPTO_STATUS_H_ |
OLD | NEW |