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