Skip to content

Commit 874cfc0

Browse files
committed
HSM: openssl_pkey_get_private(URI) support
Add the RFC7512 URI when reading the private keys.
1 parent c3c4d34 commit 874cfc0

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
@@ -3622,6 +3622,12 @@ static EVP_PKEY *php_openssl_pkey_from_zval(zval *val, int public_key, char *pas
36223622
}
36233623
} else {
36243624
/* we want the private key */
3625+
if (engine) {
3626+
key = ENGINE_load_private_key(engine, Z_STRVAL_P(val), NULL, NULL);
3627+
ENGINE_free(engine);
3628+
ENGINE_finish(engine);
3629+
engine = NULL;
3630+
} else {
36253631
BIO *in;
36263632

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

0 commit comments

Comments
 (0)