From 691f4d1e62812b34f62fcb6b07d15518d0b5b45d Mon Sep 17 00:00:00 2001 From: terrafrost Date: Tue, 13 Nov 2012 00:43:45 -0600 Subject: [PATCH] Make it so loadCA() doesn't have to be called before loadX509() or loadCRL() --- phpseclib/File/X509.php | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/phpseclib/File/X509.php b/phpseclib/File/X509.php index d8abdeb2..6ad74675 100644 --- a/phpseclib/File/X509.php +++ b/phpseclib/File/X509.php @@ -1660,8 +1660,16 @@ class File_X509 { */ function loadCA($cert) { + $olddn = $this->dn; + $oldcert = $this->currentCert; + $oldsigsubj = $this->signatureSubject; + $cert = $this->loadX509($cert); if (!$cert) { + $this->dn = $olddn; + $this->currentCert = $oldcert; + $this->signatureSubject = $oldsigsubj; + return false; } @@ -1690,8 +1698,10 @@ class File_X509 { //} $this->CAs[] = $cert; - unset($this->currentCert); - unset($this->signatureSubject); + + $this->dn = $olddn; + $this->currentCert = $oldcert; + $this->signatureSubject = $oldsigsubj; return true; }