Skip to content

Commit 18952ab

Browse files
committed
HSM: openssl_pkey_get_private(URI) support
Add the RFC7512 URI when reading the private keys.
1 parent 48f4029 commit 18952ab

File tree

1 file changed

+7
-0
lines changed

1 file changed

+7
-0
lines changed

ext/openssl/openssl.c

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3621,6 +3621,12 @@ static EVP_PKEY *php_openssl_pkey_from_zval(zval *val, int public_key, char *pas
36213621
}
36223622
} else {
36233623
/* we want the private key */
3624+
if (engine) {
3625+
key = ENGINE_load_private_key(engine, Z_STRVAL_P(val), NULL, NULL);
3626+
ENGINE_free(engine);
3627+
ENGINE_finish(engine);
3628+
engine = NULL;
3629+
} else {
36243630
BIO *in;
36253631

36263632
if (filename) {
@@ -3641,6 +3647,7 @@ static EVP_PKEY *php_openssl_pkey_from_zval(zval *val, int public_key, char *pas
36413647
key = PEM_read_bio_PrivateKey(in, NULL, php_openssl_pem_password_cb, &password);
36423648
}
36433649
BIO_free(in);
3650+
} // TODO indent, just to please/ease the first round of code review
36443651
}
36453652
}
36463653

0 commit comments

Comments
 (0)