php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Request #67500 Allow to define time in openssl_x509_checkpurpose
Submitted: 2014-06-23 09:03 UTC Modified: 2015-03-04 21:22 UTC
From: dominic dot tubach at to dot com Assigned:
Status: Wont fix Package: OpenSSL related
PHP Version: 5.5.13 OS:
Private report: No CVE-ID: None
Have you experienced this issue?
Rate the importance of this bug to you:

 [2014-06-23 09:03 UTC] dominic dot tubach at to dot com
Description:
------------
The OpenSSL verify command allows to specify a timestamp to use for the check instead of the current system time (option -attime). Can this possibility be added to the openssl_x509_checkpurpose function?


Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2015-03-04 21:22 UTC] rdlowrey@php.net
-Status: Open +Status: Wont fix
 [2015-03-04 21:22 UTC] rdlowrey@php.net
I don't believe that is the correct place to check for this type of thing.

The functionality you're looking for is already available using openssl_x509_parse() to determine if the certificate is valid at a given timestamp as shown here:

<?php
$cert = ...; // get the cert from somewhere
$info = openssl_x509_parse($cert);
$time = time(); // or any other timestamp;
$isValid = ($info['validFrom_time_t'] < $time && $time < $info['validTo_time_t']);
 
PHP Copyright © 2001-2020 The PHP Group
All rights reserved.
Last updated: Tue Oct 20 21:01:23 2020 UTC