web/lib/Zend/Crypt/Rsa.php
changeset 807 877f952ae2bd
parent 207 621fa6caec0c
child 1230 68c69c656a2c
--- a/web/lib/Zend/Crypt/Rsa.php	Thu Mar 21 17:31:31 2013 +0100
+++ b/web/lib/Zend/Crypt/Rsa.php	Thu Mar 21 19:50:53 2013 +0100
@@ -15,9 +15,9 @@
  * @category   Zend
  * @package    Zend_Crypt
  * @subpackage Rsa
- * @copyright  Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
+ * @copyright  Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com)
  * @license    http://framework.zend.com/license/new-bsd     New BSD License
- * @version    $Id: Rsa.php 23439 2010-11-23 21:10:14Z alexander $
+ * @version    $Id: Rsa.php 24808 2012-05-17 19:56:09Z rob $
  */
 
 /**
@@ -33,7 +33,7 @@
 /**
  * @category   Zend
  * @package    Zend_Crypt
- * @copyright  Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
+ * @copyright  Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com)
  * @license    http://framework.zend.com/license/new-bsd     New BSD License
  */
 class Zend_Crypt_Rsa
@@ -71,7 +71,7 @@
     {
         if (!extension_loaded('openssl')) {
             require_once 'Zend/Crypt/Rsa/Exception.php';
-            throw new Zend_Crypt_Rsa_Exception('Zend_Crypt_Rsa requires openssl extention to be loaded.');
+            throw new Zend_Crypt_Rsa_Exception('Zend_Crypt_Rsa requires openssl extension to be loaded.');
         }
 
         // Set _hashAlgorithm property when we are sure, that openssl extension is loaded
@@ -201,6 +201,13 @@
         return $decrypted;
     }
 
+    /**
+     * @param  array $configargs
+     * 
+     * @throws Zend_Crypt_Rsa_Exception
+     * 
+     * @return ArrayObject
+     */
     public function generateKeys(array $configargs = null)
     {
         $config = null;
@@ -215,6 +222,10 @@
         $privateKey = null;
         $publicKey = null;
         $resource = openssl_pkey_new($config);
+        if (!$resource) {
+            require_once 'Zend/Crypt/Rsa/Exception.php';
+            throw new Zend_Crypt_Rsa_Exception('Failed to generate a new private key');
+        }
         // above fails on PHP 5.3
         openssl_pkey_export($resource, $private, $passPhrase);
         $privateKey = new Zend_Crypt_Rsa_Key_Private($private, $passPhrase);
@@ -312,6 +323,9 @@
     protected function _parseConfigArgs(array $config = null)
     {
         $configs = array();
+        if (isset($config['private_key_bits'])) {
+            $configs['private_key_bits'] = $config['private_key_bits'];
+        }
         if (isset($config['privateKeyBits'])) {
             $configs['private_key_bits'] = $config['privateKeyBits'];
         }