| 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 266 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 277 } | 277 } |
| 278 | 278 |
| 279 // Construct an EVP_PKEY for the public key. | 279 // Construct an EVP_PKEY for the public key. |
| 280 crypto::ScopedRSA rsa_public_key(RSAPublicKey_dup(rsa_private_key.get())); | 280 crypto::ScopedRSA rsa_public_key(RSAPublicKey_dup(rsa_private_key.get())); |
| 281 crypto::ScopedEVP_PKEY public_pkey(EVP_PKEY_new()); | 281 crypto::ScopedEVP_PKEY public_pkey(EVP_PKEY_new()); |
| 282 if (!public_pkey || | 282 if (!public_pkey || |
| 283 !EVP_PKEY_set1_RSA(public_pkey.get(), rsa_public_key.get())) { | 283 !EVP_PKEY_set1_RSA(public_pkey.get(), rsa_public_key.get())) { |
| 284 return Status::OperationError(); | 284 return Status::OperationError(); |
| 285 } | 285 } |
| 286 | 286 |
| 287 blink::WebCryptoKey public_key = blink::WebCryptoKey::createNull(); | 287 blink::WebCryptoKey public_key; |
| 288 blink::WebCryptoKey private_key = blink::WebCryptoKey::createNull(); | 288 blink::WebCryptoKey private_key; |
| 289 | 289 |
| 290 // Note that extractable is unconditionally set to true. This is because per | 290 // Note that extractable is unconditionally set to true. This is because per |
| 291 // the WebCrypto spec generated public keys are always public. | 291 // the WebCrypto spec generated public keys are always public. |
| 292 status = CreateWebCryptoPublicKey(public_pkey.Pass(), | 292 status = CreateWebCryptoPublicKey(public_pkey.Pass(), |
| 293 algorithm.id(), | 293 algorithm.id(), |
| 294 params->hash(), | 294 params->hash(), |
| 295 true, | 295 true, |
| 296 public_usage_mask, | 296 public_usage_mask, |
| 297 &public_key); | 297 &public_key); |
| 298 if (status.IsError()) | 298 if (status.IsError()) |
| (...skipping 202 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 501 return Status::Success(); | 501 return Status::Success(); |
| 502 | 502 |
| 503 default: | 503 default: |
| 504 return Status::ErrorUnexpected(); | 504 return Status::ErrorUnexpected(); |
| 505 } | 505 } |
| 506 } | 506 } |
| 507 | 507 |
| 508 } // namespace webcrypto | 508 } // namespace webcrypto |
| 509 | 509 |
| 510 } // namespace content | 510 } // namespace content |
| OLD | NEW |