[php-src] PR #23988: ext/openssl: openssl_x509_checkpurpose - allow to check if the certificate is revoked + partial chain
| From: | adapik | Date: | Tue, 29 Sep 2026 12:19:28 +0000 |
| Subject: | [php-src] PR #23988: ext/openssl: openssl_x509_checkpurpose - allow to check if the certificate is revoked + partial chain | ||
| Groups: | php.git-pulls | ||
| Request: | Send a blank email to git-pulls+get-38922@lists.php.net to get a copy of this message | ||
Pull Request: https://github.com/php/php-src/pull/23988
Author: adapik
I ran into a problem: Currently PHP has no way to check if a certificate was revoked. OpenSSL can do
it, but the extension never lets you turn the setting on.
So in this PR I added an optional
$x509_verify_flags argument to
openssl_x509_checkpurpose(), plus three constants:
OPENSSL_X509_VERIFY_FLAG_CRL_CHECK, OPENSSL_X509_VERIFY_FLAG_CRL_CHECK_ALL
and OPENSSL_X509_VERIFY_FLAG_PARTIAL_CHAIN. You pass the CRL as one of the files in
$ca_info, next to the CA cert, so there's no extra parameter for it.
While digging I found the issue [#8371](https://github.com/php/php-src/issues/8371), where extra
verify options were needed too (partial chain, so an intermediate CA can be the trust anchor).
It's the same mechanism, so this PR solves both. I made PARTIAL_CHAIN opt-in, not the default,
so nobody's existing code changes behavior.
BC is fully kept: without the new argument nothing changes. Tests are included.
Solves [#8371](https://github.com/php/php-src/issues/8371).