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

Side by Side Diff: content/renderer/webcrypto/webcrypto_util.cc

Issue 141853006: [webcrypto] Validate JWK import of AES keys: key length must match algorithm. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 6 years, 10 months 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 | Annotate | Revision Log
« no previous file with comments | « content/renderer/webcrypto/webcrypto_util.h ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 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 #include "content/renderer/webcrypto/webcrypto_util.h" 5 #include "content/renderer/webcrypto/webcrypto_util.h"
6 6
7 #include "base/base64.h" 7 #include "base/base64.h"
8 #include "base/logging.h" 8 #include "base/logging.h"
9 #include "third_party/WebKit/public/platform/WebCryptoAlgorithm.h" 9 #include "third_party/WebKit/public/platform/WebCryptoAlgorithm.h"
10 #include "third_party/WebKit/public/platform/WebCryptoAlgorithmParams.h" 10 #include "third_party/WebKit/public/platform/WebCryptoAlgorithmParams.h"
(...skipping 74 matching lines...) Expand 10 before | Expand all | Expand 10 after
85 85
86 Status Status::ErrorJwkRsaPrivateKeyUnsupported() { 86 Status Status::ErrorJwkRsaPrivateKeyUnsupported() {
87 return Status("JWK RSA key contained \"d\" property: Private key import is " 87 return Status("JWK RSA key contained \"d\" property: Private key import is "
88 "not yet supported"); 88 "not yet supported");
89 } 89 }
90 90
91 Status Status::ErrorJwkUnrecognizedKty() { 91 Status Status::ErrorJwkUnrecognizedKty() {
92 return Status("The JWK \"kty\" property was unrecognized"); 92 return Status("The JWK \"kty\" property was unrecognized");
93 } 93 }
94 94
95 Status Status::ErrorJwkIncorrectKeyLength() {
96 return Status("The JWK \"k\" property did not include the right length "
97 "of key data for the given algorithm.");
98 }
99
95 Status Status::ErrorImportEmptyKeyData() { 100 Status Status::ErrorImportEmptyKeyData() {
96 return Status("No key data was provided"); 101 return Status("No key data was provided");
97 } 102 }
98 103
99 Status Status::ErrorUnexpectedKeyType() { 104 Status Status::ErrorUnexpectedKeyType() {
100 return Status("The key is not of the expected type"); 105 return Status("The key is not of the expected type");
101 } 106 }
102 107
103 Status Status::ErrorIncorrectSizeAesCbcIv() { 108 Status Status::ErrorIncorrectSizeAesCbcIv() {
104 return Status("The \"iv\" has an unexpected length -- must be 16 bytes"); 109 return Status("The \"iv\" has an unexpected length -- must be 16 bytes");
(...skipping 209 matching lines...) Expand 10 before | Expand all | Expand 10 after
314 return 128; 319 return 128;
315 default: 320 default:
316 NOTREACHED(); 321 NOTREACHED();
317 return 0; 322 return 0;
318 } 323 }
319 } 324 }
320 325
321 } // namespace webcrypto 326 } // namespace webcrypto
322 327
323 } // namespace content 328 } // namespace content
OLDNEW
« no previous file with comments | « content/renderer/webcrypto/webcrypto_util.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698