swapping pear error handling so Crypt_RSA can properly detect available

math libraries
This commit is contained in:
James Walker 2010-02-22 19:00:27 -05:00
parent 3b823f8fbd
commit caad5859b5

View File

@ -57,8 +57,10 @@ class MagicsigRsaSha256
$keypair = new Crypt_RSA_KeyPair($key_length); $keypair = new Crypt_RSA_KeyPair($key_length);
$params['public_key'] = $keypair->getPublicKey(); $params['public_key'] = $keypair->getPublicKey();
$params['private_key'] = $keypair->getPrivateKey(); $params['private_key'] = $keypair->getPrivateKey();
PEAR::pushErrorHandling(PEAR_ERROR_RETURN);
$this->keypair = new Crypt_RSA($params); $this->keypair = new Crypt_RSA($params);
PEAR::popErrorHandling();
} }
@ -79,6 +81,8 @@ class MagicsigRsaSha256
public function fromString($text) public function fromString($text)
{ {
PEAR::pushErrorHandling(PEAR_ERROR_RETURN);
// remove whitespace // remove whitespace
$text = preg_replace('/\s+/', '', $text); $text = preg_replace('/\s+/', '', $text);
@ -86,7 +90,6 @@ class MagicsigRsaSha256
if (!preg_match('/RSA\.([^\.]+)\.([^\.]+)(.([^\.]+))?/', $text, $matches)) { if (!preg_match('/RSA\.([^\.]+)\.([^\.]+)(.([^\.]+))?/', $text, $matches)) {
return false; return false;
} }
$mod = base64_url_decode($matches[1]); $mod = base64_url_decode($matches[1]);
$exp = base64_url_decode($matches[2]); $exp = base64_url_decode($matches[2]);
@ -110,6 +113,7 @@ class MagicsigRsaSha256
} }
$this->keypair = new Crypt_RSA($params); $this->keypair = new Crypt_RSA($params);
PEAR::popErrorHandling();
} }
public function getName() public function getName()