| 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 51 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 62 const std::string& expected_type); | 62 const std::string& expected_type); |
| 63 | 63 |
| 64 // The property |property| was a string, however could not be successfully | 64 // The property |property| was a string, however could not be successfully |
| 65 // base64 decoded. | 65 // base64 decoded. |
| 66 static Status ErrorJwkBase64Decode(const std::string& property); | 66 static Status ErrorJwkBase64Decode(const std::string& property); |
| 67 | 67 |
| 68 // The "ext" parameter was specified but was | 68 // The "ext" parameter was specified but was |
| 69 // incompatible with the value requested by the Web Crypto call. | 69 // incompatible with the value requested by the Web Crypto call. |
| 70 static Status ErrorJwkExtInconsistent(); | 70 static Status ErrorJwkExtInconsistent(); |
| 71 | 71 |
| 72 // The "alg" parameter could not be converted to an equivalent | |
| 73 // WebCryptoAlgorithm. Either it was malformed or unrecognized. | |
| 74 static Status ErrorJwkUnrecognizedAlgorithm(); | |
| 75 | |
| 76 // The "alg" parameter is incompatible with the (optional) Algorithm | 72 // The "alg" parameter is incompatible with the (optional) Algorithm |
| 77 // specified by the Web Crypto import operation. | 73 // specified by the Web Crypto import operation. |
| 78 static Status ErrorJwkAlgorithmInconsistent(); | 74 static Status ErrorJwkAlgorithmInconsistent(); |
| 79 | 75 |
| 80 // The "use" parameter was specified, however it couldn't be converted to an | 76 // The "use" parameter was specified, however it couldn't be converted to an |
| 81 // equivalent Web Crypto usage. | 77 // equivalent Web Crypto usage. |
| 82 static Status ErrorJwkUnrecognizedUse(); | 78 static Status ErrorJwkUnrecognizedUse(); |
| 83 | 79 |
| 84 // The "key_ops" parameter was specified, however one of the values in the | 80 // The "key_ops" parameter was specified, however one of the values in the |
| 85 // array couldn't be converted to an equivalent Web Crypto usage. | 81 // array couldn't be converted to an equivalent Web Crypto usage. |
| 86 static Status ErrorJwkUnrecognizedKeyop(); | 82 static Status ErrorJwkUnrecognizedKeyop(); |
| 87 | 83 |
| 88 // The "use" parameter was specified, however it is incompatible with that | 84 // The "use" parameter was specified, however it is incompatible with that |
| 89 // specified by the Web Crypto import operation. | 85 // specified by the Web Crypto import operation. |
| 90 static Status ErrorJwkUseInconsistent(); | 86 static Status ErrorJwkUseInconsistent(); |
| 91 | 87 |
| 92 // The "key_ops" parameter was specified, however it is incompatible with that | 88 // The "key_ops" parameter was specified, however it is incompatible with that |
| 93 // specified by the Web Crypto import operation. | 89 // specified by the Web Crypto import operation. |
| 94 static Status ErrorJwkKeyopsInconsistent(); | 90 static Status ErrorJwkKeyopsInconsistent(); |
| 95 | 91 |
| 96 // Both the "key_ops" and the "use" parameters were specified, however they | 92 // Both the "key_ops" and the "use" parameters were specified, however they |
| 97 // are incompatible with each other. | 93 // are incompatible with each other. |
| 98 static Status ErrorJwkUseAndKeyopsInconsistent(); | 94 static Status ErrorJwkUseAndKeyopsInconsistent(); |
| 99 | 95 |
| 100 // The "kty" parameter was given and was a string, however it was | 96 // The "kty" parameter was given and was a string, however it was not the |
| 101 // unrecognized. | 97 // expected value. |
| 102 static Status ErrorJwkUnrecognizedKty(); | 98 static Status ErrorJwkUnexpectedKty(const std::string& expected); |
| 103 | 99 |
| 104 // The amount of key data provided was incompatible with the selected | 100 // The amount of key data provided was incompatible with the selected |
| 105 // algorithm. For instance if the algorith name was A128CBC then EXACTLY | 101 // algorithm. For instance if the algorith name was A128CBC then EXACTLY |
| 106 // 128-bits of key data must have been provided. If 192-bits of key data were | 102 // 128-bits of key data must have been provided. If 192-bits of key data were |
| 107 // given that is an error. | 103 // given that is an error. |
| 108 static Status ErrorJwkIncorrectKeyLength(); | 104 static Status ErrorJwkIncorrectKeyLength(); |
| 109 | 105 |
| 110 // The JWK was for an RSA private key but only partially provided the optional | 106 // The JWK was for an RSA private key but only partially provided the optional |
| 111 // parameters (p, q, dq, dq, qi). | 107 // parameters (p, q, dq, dq, qi). |
| 112 static Status ErrorJwkIncompleteOptionalRsaPrivateKey(); | 108 static Status ErrorJwkIncompleteOptionalRsaPrivateKey(); |
| 113 | 109 |
| 114 // ------------------------------------ | 110 // ------------------------------------ |
| 115 // Other errors | 111 // Other errors |
| 116 // ------------------------------------ | 112 // ------------------------------------ |
| 117 | 113 |
| 118 // No key data was provided when importing an spki, pkcs8, or jwk formatted | 114 // No key data was provided when importing an spki, pkcs8, or jwk formatted |
| 119 // key. This does not apply to raw format, since it is possible to have empty | 115 // key. This does not apply to raw format, since it is possible to have empty |
| 120 // key data there. | 116 // key data there. |
| 121 static Status ErrorImportEmptyKeyData(); | 117 static Status ErrorImportEmptyKeyData(); |
| 122 | 118 |
| 119 // Tried importing a key using an unsupported format for the key type (for |
| 120 // instance importing an HMAC key using format=spki). |
| 121 static Status ErrorUnsupportedImportKeyFormat(); |
| 122 |
| 123 // Tried exporting a key using an unsupported format for the key type (for |
| 124 // instance exporting an HMAC key using format=spki). |
| 125 static Status ErrorUnsupportedExportKeyFormat(); |
| 126 |
| 123 // The key data buffer provided for importKey() is an incorrect length for | 127 // The key data buffer provided for importKey() is an incorrect length for |
| 124 // AES. | 128 // AES. |
| 125 static Status ErrorImportAesKeyLength(); | 129 static Status ErrorImportAesKeyLength(); |
| 126 | 130 |
| 127 // 192-bit AES keys are valid, however unsupported. | 131 // 192-bit AES keys are valid, however unsupported. |
| 128 static Status ErrorAes192BitUnsupported(); | 132 static Status ErrorAes192BitUnsupported(); |
| 129 | 133 |
| 130 // The wrong key was used for the operation. For instance, a public key was | 134 // The wrong key was used for the operation. For instance, a public key was |
| 131 // used to verify a RsaSsaPkcs1v1_5 signature, or tried exporting a private | 135 // used to verify a RsaSsaPkcs1v1_5 signature, or tried exporting a private |
| 132 // key using spki format. | 136 // key using spki format. |
| (...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 203 Type type_; | 207 Type type_; |
| 204 blink::WebCryptoErrorType error_type_; | 208 blink::WebCryptoErrorType error_type_; |
| 205 std::string error_details_; | 209 std::string error_details_; |
| 206 }; | 210 }; |
| 207 | 211 |
| 208 } // namespace webcrypto | 212 } // namespace webcrypto |
| 209 | 213 |
| 210 } // namespace content | 214 } // namespace content |
| 211 | 215 |
| 212 #endif // CONTENT_CHILD_WEBCRYPTO_STATUS_H_ | 216 #endif // CONTENT_CHILD_WEBCRYPTO_STATUS_H_ |
| OLD | NEW |