|
|
@@ -218,8 +218,13 @@ class Zend_Crypt_Rsa
|
|
|
public function setPemString($value)
|
|
|
{
|
|
|
$this->_pemString = $value;
|
|
|
- $this->_privateKey = new Zend_Crypt_Rsa_Key_Private($this->_pemString, $this->_passPhrase);
|
|
|
- $this->_publicKey = $this->_privateKey->getPublicKey();
|
|
|
+ try {
|
|
|
+ $this->_privateKey = new Zend_Crypt_Rsa_Key_Private($this->_pemString, $this->_passPhrase);
|
|
|
+ $this->_publicKey = $this->_privateKey->getPublicKey();
|
|
|
+ } catch (Zend_Crypt_Exception $e) {
|
|
|
+ $this->_privateKey = null;
|
|
|
+ $this->_publicKey = new Zend_Crypt_Rsa_Key_Public($this->_pemString);
|
|
|
+ }
|
|
|
}
|
|
|
|
|
|
public function setPemPath($value)
|
|
|
@@ -242,7 +247,7 @@ class Zend_Crypt_Rsa
|
|
|
|
|
|
public function setHashAlgorithm($name)
|
|
|
{
|
|
|
- switch ($name) {
|
|
|
+ switch (strtolower($name)) {
|
|
|
case 'md2':
|
|
|
$this->_hashAlgorithm = OPENSSL_ALGO_MD2;
|
|
|
break;
|
|
|
@@ -252,6 +257,12 @@ class Zend_Crypt_Rsa
|
|
|
case 'md5':
|
|
|
$this->_hashAlgorithm = OPENSSL_ALGO_MD5;
|
|
|
break;
|
|
|
+ case 'sha1':
|
|
|
+ $this->_hashAlgorithm = OPENSSL_ALGO_SHA1;
|
|
|
+ break;
|
|
|
+ case 'dss1':
|
|
|
+ $this->_hashAlgorithm = OPENSSL_ALGO_DSS1;
|
|
|
+ break;
|
|
|
}
|
|
|
}
|
|
|
|
|
|
@@ -295,4 +306,4 @@ class Zend_Crypt_Rsa
|
|
|
return null;
|
|
|
}
|
|
|
|
|
|
-}
|
|
|
+}
|