@@ -385,6 +385,11 @@ KeyObjectData ImportJWKRsaKey(Environment* env,
|
385 | 385 | KeyType type = d_value->IsString() ? kKeyTypePrivate : kKeyTypePublic; |
386 | 386 | |
387 | 387 | RSAPointer rsa(RSA_new()); |
| 388 | +if (!rsa) { |
| 389 | +THROW_ERR_CRYPTO_OPERATION_FAILED(env, "Unable to create RSA pointer"); |
| 390 | +return {}; |
| 391 | + } |
| 392 | + |
388 | 393 | ncrypto::Rsa rsa_view(rsa.get()); |
389 | 394 | |
390 | 395 | ByteSource n = ByteSource::FromEncodedString(env, n_value.As<String>()); |
@@ -435,7 +440,10 @@ KeyObjectData ImportJWKRsaKey(Environment* env,
|
435 | 440 | } |
436 | 441 | |
437 | 442 | auto pkey = EVPKeyPointer::NewRSA(std::move(rsa)); |
438 | | -if (!pkey) return {}; |
| 443 | +if (!pkey) { |
| 444 | +THROW_ERR_CRYPTO_OPERATION_FAILED(env, "Unable to create key pointer"); |
| 445 | +return {}; |
| 446 | + } |
439 | 447 | |
440 | 448 | return KeyObjectData::CreateAsymmetric(type, std::move(pkey)); |
441 | 449 | } |
|