mirror of
https://github.com/phpseclib/phpseclib.git
synced 2024-12-27 19:54:57 +00:00
CS adjustments, make it so PEM-encoded CRLs can be read (again) and make it so already decoded CSRs and CRLs can be read
This commit is contained in:
parent
875cef8bbd
commit
76cb693d62
@ -1354,7 +1354,7 @@ class File_X509 {
|
|||||||
if (is_array($cert) && isset($cert['tbsCertificate'])) {
|
if (is_array($cert) && isset($cert['tbsCertificate'])) {
|
||||||
$this->currentCert = $cert;
|
$this->currentCert = $cert;
|
||||||
unset($this->signatureSubject);
|
unset($this->signatureSubject);
|
||||||
return false;
|
return $cert;
|
||||||
}
|
}
|
||||||
|
|
||||||
$asn1 = new File_ASN1();
|
$asn1 = new File_ASN1();
|
||||||
@ -2545,6 +2545,12 @@ class File_X509 {
|
|||||||
*/
|
*/
|
||||||
function loadCSR($csr)
|
function loadCSR($csr)
|
||||||
{
|
{
|
||||||
|
if (is_array($csr) && isset($csr['certificationRequestInfo'])) {
|
||||||
|
$this->currentCert = $csr;
|
||||||
|
unset($this->signatureSubject);
|
||||||
|
return $csr;
|
||||||
|
}
|
||||||
|
|
||||||
// see http://tools.ietf.org/html/rfc2986
|
// see http://tools.ietf.org/html/rfc2986
|
||||||
|
|
||||||
$asn1 = new File_ASN1();
|
$asn1 = new File_ASN1();
|
||||||
@ -2645,9 +2651,15 @@ class File_X509 {
|
|||||||
*/
|
*/
|
||||||
function loadCRL($crl)
|
function loadCRL($crl)
|
||||||
{
|
{
|
||||||
|
if (is_array($crl) && isset($crl['tbsCertList'])) {
|
||||||
|
$this->currentCert = $crl;
|
||||||
|
unset($this->signatureSubject);
|
||||||
|
return $crl;
|
||||||
|
}
|
||||||
|
|
||||||
$asn1 = new File_ASN1();
|
$asn1 = new File_ASN1();
|
||||||
|
|
||||||
$temp = preg_replace('#^(?:[^-].+[\r\n]+)+|-.+-|[\r\n]| #', '', $csr);
|
$temp = preg_replace('#^(?:[^-].+[\r\n]+)+|-.+-|[\r\n]| #', '', $crl);
|
||||||
$temp = preg_match('#^[a-zA-Z\d/+]*={0,2}$#', $temp) ? base64_decode($temp) : false;
|
$temp = preg_match('#^[a-zA-Z\d/+]*={0,2}$#', $temp) ? base64_decode($temp) : false;
|
||||||
if ($temp != false) {
|
if ($temp != false) {
|
||||||
$crl = $temp;
|
$crl = $temp;
|
||||||
@ -2988,8 +3000,7 @@ class File_X509 {
|
|||||||
|
|
||||||
if (!empty($this->endDate)) {
|
if (!empty($this->endDate)) {
|
||||||
$tbsCertList['nextUpdate'] = array('generalTime' => $this->endDate); // $this->setEndDate()
|
$tbsCertList['nextUpdate'] = array('generalTime' => $this->endDate); // $this->setEndDate()
|
||||||
}
|
} else {
|
||||||
else {
|
|
||||||
unset($tbsCertList['nextUpdate']);
|
unset($tbsCertList['nextUpdate']);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -2999,7 +3010,7 @@ class File_X509 {
|
|||||||
else {
|
else {
|
||||||
$crlNumber = $this->getExtension('id-ce-cRLNumber');
|
$crlNumber = $this->getExtension('id-ce-cRLNumber');
|
||||||
$crlNumber = $crlNumber !== false ? $crlNumber->add(new Math_BigInteger(1)) : NULL;
|
$crlNumber = $crlNumber !== false ? $crlNumber->add(new Math_BigInteger(1)) : NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
$this->removeExtension('id-ce-authorityKeyIdentifier');
|
$this->removeExtension('id-ce-authorityKeyIdentifier');
|
||||||
$this->removeExtension('id-ce-issuerAltName');
|
$this->removeExtension('id-ce-issuerAltName');
|
||||||
|
Loading…
Reference in New Issue
Block a user