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

Side by Side Diff: content/child/webcrypto/openssl/rsa_key_openssl.cc

Issue 777403004: [WebCrypto] Throw syntaxError if keyUsage is empty in ImportKey (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Updated issues in ecdh tests and other review comments. Created 6 years 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 #include "content/child/webcrypto/openssl/rsa_key_openssl.h" 5 #include "content/child/webcrypto/openssl/rsa_key_openssl.h"
6 6
7 #include <openssl/evp.h> 7 #include <openssl/evp.h>
8 8
9 #include "base/logging.h" 9 #include "base/logging.h"
10 #include "base/stl_util.h" 10 #include "base/stl_util.h"
(...skipping 286 matching lines...) Expand 10 before | Expand all | Expand 10 after
297 297
298 JwkRsaInfo jwk; 298 JwkRsaInfo jwk;
299 Status status = 299 Status status =
300 ReadRsaKeyJwk(key_data, jwk_algorithm, extractable, usages, &jwk); 300 ReadRsaKeyJwk(key_data, jwk_algorithm, extractable, usages, &jwk);
301 if (status.IsError()) 301 if (status.IsError())
302 return status; 302 return status;
303 303
304 // Once the key type is known, verify the usages. 304 // Once the key type is known, verify the usages.
305 status = CheckKeyCreationUsages( 305 status = CheckKeyCreationUsages(
306 jwk.is_private_key ? all_private_key_usages_ : all_public_key_usages_, 306 jwk.is_private_key ? all_private_key_usages_ : all_public_key_usages_,
307 usages); 307 usages, !jwk.is_private_key);
308 if (status.IsError()) 308 if (status.IsError())
309 return status; 309 return status;
310 310
311 return jwk.is_private_key 311 return jwk.is_private_key
312 ? ImportRsaPrivateKey(algorithm, extractable, usages, jwk, key) 312 ? ImportRsaPrivateKey(algorithm, extractable, usages, jwk, key)
313 : ImportRsaPublicKey(algorithm, extractable, usages, 313 : ImportRsaPublicKey(algorithm, extractable, usages,
314 CryptoData(jwk.n), CryptoData(jwk.e), key); 314 CryptoData(jwk.n), CryptoData(jwk.e), key);
315 } 315 }
316 316
317 Status RsaHashedAlgorithm::ExportKeyPkcs8(const blink::WebCryptoKey& key, 317 Status RsaHashedAlgorithm::ExportKeyPkcs8(const blink::WebCryptoKey& key,
(...skipping 107 matching lines...) Expand 10 before | Expand all | Expand 10 after
425 key->algorithm().rsaHashedParams()->publicExponent().size())) { 425 key->algorithm().rsaHashedParams()->publicExponent().size())) {
426 return Status::ErrorUnexpected(); 426 return Status::ErrorUnexpected();
427 } 427 }
428 428
429 return Status::Success(); 429 return Status::Success();
430 } 430 }
431 431
432 } // namespace webcrypto 432 } // namespace webcrypto
433 433
434 } // namespace content 434 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698