Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(178)

Side by Side Diff: content/child/webcrypto/status.h

Issue 689883002: Throw a SyntaxError when importing keys with invalid usages (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 6 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 190 matching lines...) Expand 10 before | Expand all | Expand 10 after
201 // The exponent bytes were empty when importing an RSA public key. 201 // The exponent bytes were empty when importing an RSA public key.
202 static Status ErrorImportRsaEmptyExponent(); 202 static Status ErrorImportRsaEmptyExponent();
203 203
204 // An unextractable key was used by an operation which exports the key data. 204 // An unextractable key was used by an operation which exports the key data.
205 static Status ErrorKeyNotExtractable(); 205 static Status ErrorKeyNotExtractable();
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
eroman 2014/10/30 19:03:30 This comment is no longer applicable, please updat
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 SyntaxError();
215 static Status SyntaxError(const std::string& parameter);
215 216
216 private: 217 private:
217 enum Type { TYPE_ERROR, TYPE_SUCCESS }; 218 enum Type { TYPE_ERROR, TYPE_SUCCESS };
218 219
219 // Constructs an error with the specified error type and message. 220 // Constructs an error with the specified error type and message.
220 Status(blink::WebCryptoErrorType error_type, 221 Status(blink::WebCryptoErrorType error_type,
221 const std::string& error_details_utf8); 222 const std::string& error_details_utf8);
222 223
223 // Constructs a success or error without any details. 224 // Constructs a success or error without any details.
224 explicit Status(Type type); 225 explicit Status(Type type);
225 226
226 Type type_; 227 Type type_;
227 blink::WebCryptoErrorType error_type_; 228 blink::WebCryptoErrorType error_type_;
228 std::string error_details_; 229 std::string error_details_;
229 }; 230 };
230 231
231 } // namespace webcrypto 232 } // namespace webcrypto
232 233
233 } // namespace content 234 } // namespace content
234 235
235 #endif // CONTENT_CHILD_WEBCRYPTO_STATUS_H_ 236 #endif // CONTENT_CHILD_WEBCRYPTO_STATUS_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698