| 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 #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 #include <openssl/pkcs12.h> | 8 #include <openssl/pkcs12.h> |
| 9 | 9 |
| 10 #include "base/logging.h" | 10 #include "base/logging.h" |
| (...skipping 310 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 321 case blink::WebCryptoKeyFormatJwk: | 321 case blink::WebCryptoKeyFormatJwk: |
| 322 // The JWK could represent either a public key or private key. The usages | 322 // The JWK could represent either a public key or private key. The usages |
| 323 // must make sense for one of the two. The usages will be checked again by | 323 // must make sense for one of the two. The usages will be checked again by |
| 324 // ImportKeyJwk() once the key type has been determined. | 324 // ImportKeyJwk() once the key type has been determined. |
| 325 if (CheckKeyCreationUsages(all_private_key_usages_, usages) | 325 if (CheckKeyCreationUsages(all_private_key_usages_, usages) |
| 326 .IsSuccess() || | 326 .IsSuccess() || |
| 327 CheckKeyCreationUsages(all_public_key_usages_, usages) | 327 CheckKeyCreationUsages(all_public_key_usages_, usages) |
| 328 .IsSuccess()) { | 328 .IsSuccess()) { |
| 329 return Status::Success(); | 329 return Status::Success(); |
| 330 } | 330 } |
| 331 return Status::ErrorCreateKeyBadUsages(); | 331 return Status::SyntaxError("usages"); |
| 332 default: | 332 default: |
| 333 return Status::ErrorUnsupportedImportKeyFormat(); | 333 return Status::ErrorUnsupportedImportKeyFormat(); |
| 334 } | 334 } |
| 335 } | 335 } |
| 336 | 336 |
| 337 Status RsaHashedAlgorithm::ImportKeyPkcs8( | 337 Status RsaHashedAlgorithm::ImportKeyPkcs8( |
| 338 const CryptoData& key_data, | 338 const CryptoData& key_data, |
| 339 const blink::WebCryptoAlgorithm& algorithm, | 339 const blink::WebCryptoAlgorithm& algorithm, |
| 340 bool extractable, | 340 bool extractable, |
| 341 blink::WebCryptoKeyUsageMask usages, | 341 blink::WebCryptoKeyUsageMask usages, |
| (...skipping 165 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 507 return Status::Success(); | 507 return Status::Success(); |
| 508 | 508 |
| 509 default: | 509 default: |
| 510 return Status::ErrorUnexpected(); | 510 return Status::ErrorUnexpected(); |
| 511 } | 511 } |
| 512 } | 512 } |
| 513 | 513 |
| 514 } // namespace webcrypto | 514 } // namespace webcrypto |
| 515 | 515 |
| 516 } // namespace content | 516 } // namespace content |
| OLD | NEW |