Skip to content

Commit 98e2948

Browse files
vjardindevnexen
authored andcommitted
ext/openssl: Add X509 purpose constants.
- X509_PURPOSE_OCSP_HELPER. - X509_PURPOSE_TIMESTAMP_SIGN. - Also X509_PURPOSE_ANY is ok since 1.0.1+ Close GH-13149
1 parent 4bd6356 commit 98e2948

File tree

5 files changed

+31
-5
lines changed

5 files changed

+31
-5
lines changed

NEWS

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -59,6 +59,8 @@ OpenSSL:
5959
(Jakub Zelenka)
6060
. Introduced new serial_hex parameter to openssl_csr_sign. (Jakub Zelenka,
6161
Florian Sowade)
62+
. Added X509_PURPOSE_OCSP_HELPER and X509_PURPOSE_TIMESTAMP_SIGN constants.
63+
(Vincent Jardin)
6264

6365
PDO:
6466
. Fixed setAttribute and getAttribute. (SakiTakamachi)

UPGRADING

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -418,6 +418,10 @@ PDO_SQLITE:
418418
. The IntlDateFormatter class exposes now the new PATTERN constant
419419
reflecting udat api's UDAT_PATTERN.
420420

421+
- OpenSSL:
422+
. X509_PURPOSE_OCSP_HELPER.
423+
. X509_PURPOSE_TIMESTAMP_SIGN.
424+
421425
- Standard:
422426
. PHP_ROUND_CEILING.
423427
. PHP_ROUND_FLOOR.

ext/openssl/openssl.stub.php

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -44,13 +44,21 @@
4444
* @cvalue X509_PURPOSE_CRL_SIGN
4545
*/
4646
const X509_PURPOSE_CRL_SIGN = UNKNOWN;
47-
#ifdef X509_PURPOSE_ANY
4847
/**
4948
* @var int
5049
* @cvalue X509_PURPOSE_ANY
5150
*/
5251
const X509_PURPOSE_ANY = UNKNOWN;
53-
#endif
52+
/**
53+
* @var int
54+
* @cvalue X509_PURPOSE_OCSP_HELPER
55+
*/
56+
const X509_PURPOSE_OCSP_HELPER = UNKNOWN;
57+
/**
58+
* @var int
59+
* @cvalue X509_PURPOSE_TIMESTAMP_SIGN
60+
*/
61+
const X509_PURPOSE_TIMESTAMP_SIGN = UNKNOWN;
5462

5563
/* digest algorithm constants */
5664

ext/openssl/openssl_arginfo.h

Lines changed: 3 additions & 3 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

ext/openssl/tests/openssl_x509_checkpurpose_basic.phpt

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,8 @@ var_dump(openssl_x509_checkpurpose($sert, X509_PURPOSE_SMIME_SIGN));
4242
var_dump(openssl_x509_checkpurpose($sert, X509_PURPOSE_SMIME_ENCRYPT));
4343
var_dump(openssl_x509_checkpurpose($sert, X509_PURPOSE_CRL_SIGN));
4444
var_dump(openssl_x509_checkpurpose($sert, X509_PURPOSE_ANY));
45+
var_dump(openssl_x509_checkpurpose($sert, X509_PURPOSE_OCSP_HELPER));
46+
var_dump(openssl_x509_checkpurpose($sert, X509_PURPOSE_TIMESTAMP_SIGN));
4547

4648
/* int openssl_x509_checkpurpose ( mixed $x509cert , int $purpose [, array $cainfo = array() ] ); */
4749
var_dump(openssl_x509_checkpurpose($cert, X509_PURPOSE_SSL_CLIENT, array($cpca)));
@@ -65,6 +67,8 @@ var_dump(openssl_x509_checkpurpose($sert, X509_PURPOSE_SMIME_SIGN, array($cpca))
6567
var_dump(openssl_x509_checkpurpose($sert, X509_PURPOSE_SMIME_ENCRYPT, array($cpca)));
6668
var_dump(openssl_x509_checkpurpose($sert, X509_PURPOSE_CRL_SIGN, array($cpca)));
6769
var_dump(openssl_x509_checkpurpose($sert, X509_PURPOSE_ANY, array($cpca)));
70+
var_dump(openssl_x509_checkpurpose($sert, X509_PURPOSE_OCSP_HELPER, array($cpca)));
71+
var_dump(openssl_x509_checkpurpose($sert, X509_PURPOSE_TIMESTAMP_SIGN, array($cpca)));
6872

6973
/* int openssl_x509_checkpurpose ( mixed $x509cert , int $purpose [, array $cainfo = array() [, string $untrustedfile ]] ); function */
7074
var_dump(openssl_x509_checkpurpose($cert, X509_PURPOSE_SSL_CLIENT, array($cpca), $utfl));
@@ -88,6 +92,8 @@ var_dump(openssl_x509_checkpurpose($sert, X509_PURPOSE_SMIME_SIGN, array($cpca),
8892
var_dump(openssl_x509_checkpurpose($sert, X509_PURPOSE_SMIME_ENCRYPT, array($cpca), $utfl));
8993
var_dump(openssl_x509_checkpurpose($sert, X509_PURPOSE_CRL_SIGN, array($cpca), $utfl));
9094
var_dump(openssl_x509_checkpurpose($sert, X509_PURPOSE_ANY, array($cpca), $utfl));
95+
var_dump(openssl_x509_checkpurpose($sert, X509_PURPOSE_OCSP_HELPER, array($cpca), $utfl));
96+
var_dump(openssl_x509_checkpurpose($sert, X509_PURPOSE_TIMESTAMP_SIGN, array($cpca), $utfl));
9197
?>
9298
--CLEAN--
9399
<?php
@@ -122,6 +128,8 @@ bool(false)
122128
bool(false)
123129
bool(false)
124130
bool(false)
131+
bool(false)
132+
bool(false)
125133
int(-1)
126134
int(-1)
127135
int(-1)
@@ -136,6 +144,8 @@ bool(true)
136144
bool(true)
137145
bool(true)
138146
bool(true)
147+
bool(true)
148+
bool(false)
139149
bool(false)
140150
bool(false)
141151
bool(false)
@@ -157,3 +167,5 @@ bool(true)
157167
bool(true)
158168
bool(true)
159169
bool(true)
170+
bool(true)
171+
bool(false)

0 commit comments

Comments
 (0)