import v1.1.0_beta1 | 2009-08-21
This commit is contained in:
@ -17,7 +17,7 @@
|
||||
* @subpackage Zend_InfoCard_Cipher
|
||||
* @copyright Copyright (c) 2005-2008 Zend Technologies USA Inc. (http://www.zend.com)
|
||||
* @license http://framework.zend.com/license/new-bsd New BSD License
|
||||
* @version $Id: Abstract.php 9094 2008-03-30 18:36:55Z thomas $
|
||||
* @version $Id: Abstract.php 13213 2008-12-14 11:05:07Z thomas $
|
||||
*/
|
||||
|
||||
/**
|
||||
@ -25,11 +25,6 @@
|
||||
*/
|
||||
require_once 'Zend/InfoCard/Cipher/Pki/Interface.php';
|
||||
|
||||
/**
|
||||
* Zend_InfoCard_Cipher_Exception
|
||||
*/
|
||||
require_once 'Zend/InfoCard/Cipher/Exception.php';
|
||||
|
||||
/**
|
||||
* An abstract class for public-key ciphers
|
||||
*
|
||||
@ -73,7 +68,9 @@ abstract class Zend_InfoCard_Cipher_Pki_Adapter_Abstract implements Zend_InfoCar
|
||||
$this->_padding = $padding;
|
||||
break;
|
||||
default:
|
||||
require_once 'Zend/InfoCard/Cipher/Exception.php';
|
||||
throw new Zend_InfoCard_Cipher_Exception("Invalid Padding Type Provided");
|
||||
break;
|
||||
}
|
||||
|
||||
return $this;
|
||||
|
@ -17,7 +17,7 @@
|
||||
* @subpackage Zend_InfoCard_Cipher
|
||||
* @copyright Copyright (c) 2005-2008 Zend Technologies USA Inc. (http://www.zend.com)
|
||||
* @license http://framework.zend.com/license/new-bsd New BSD License
|
||||
* @version $Id: Rsa.php 9094 2008-03-30 18:36:55Z thomas $
|
||||
* @version $Id: Rsa.php 13522 2009-01-06 16:35:55Z thomas $
|
||||
*/
|
||||
|
||||
/**
|
||||
@ -55,6 +55,7 @@ class Zend_InfoCard_Cipher_Pki_Adapter_Rsa
|
||||
// Can't test this..
|
||||
// @codeCoverageIgnoreStart
|
||||
if(!extension_loaded('openssl')) {
|
||||
require_once 'Zend/InfoCard/Cipher/Exception.php';
|
||||
throw new Zend_InfoCard_Cipher_Exception("Use of this PKI RSA Adapter requires the openssl extension loaded");
|
||||
}
|
||||
// @codeCoverageIgnoreEnd
|
||||
@ -77,10 +78,11 @@ class Zend_InfoCard_Cipher_Pki_Adapter_Rsa
|
||||
$private_key = openssl_pkey_get_private(array($privateKey, $password));
|
||||
|
||||
if(!$private_key) {
|
||||
require_once 'Zend/InfoCard/Cipher/Exception.php';
|
||||
throw new Zend_InfoCard_Cipher_Exception("Failed to load private key");
|
||||
}
|
||||
|
||||
if(!is_null($padding)) {
|
||||
if($padding !== null) {
|
||||
try {
|
||||
$this->setPadding($padding);
|
||||
} catch(Exception $e) {
|
||||
@ -103,6 +105,7 @@ class Zend_InfoCard_Cipher_Pki_Adapter_Rsa
|
||||
openssl_free_key($private_key);
|
||||
|
||||
if(!$result) {
|
||||
require_once 'Zend/InfoCard/Cipher/Exception.php';
|
||||
throw new Zend_InfoCard_Cipher_Exception("Unable to Decrypt Value using provided private key");
|
||||
}
|
||||
|
||||
|
@ -17,7 +17,7 @@
|
||||
* @subpackage Zend_InfoCard_Cipher
|
||||
* @copyright Copyright (c) 2005-2008 Zend Technologies USA Inc. (http://www.zend.com)
|
||||
* @license http://framework.zend.com/license/new-bsd New BSD License
|
||||
* @version $Id: Aes256cbc.php 9094 2008-03-30 18:36:55Z thomas $
|
||||
* @version $Id: Aes256cbc.php 13522 2009-01-06 16:35:55Z thomas $
|
||||
*/
|
||||
|
||||
/**
|
||||
@ -30,11 +30,6 @@ require_once 'Zend/InfoCard/Cipher/Symmetric/Adapter/Abstract.php';
|
||||
*/
|
||||
require_once 'Zend/InfoCard/Cipher/Symmetric/Aes256cbc/Interface.php';
|
||||
|
||||
/**
|
||||
* Zend_InfoCard_Cipher_Exception
|
||||
*/
|
||||
require_once 'Zend/InfoCard/Cipher/Exception.php';
|
||||
|
||||
/**
|
||||
* Implements AES256 with CBC encryption implemented using the mCrypt extension
|
||||
*
|
||||
@ -73,6 +68,7 @@ class Zend_InfoCard_Cipher_Symmetric_Adapter_Aes256cbc
|
||||
// Can't test for this
|
||||
// @codeCoverageIgnoreStart
|
||||
if(!extension_loaded('mcrypt')) {
|
||||
require_once 'Zend/InfoCard/Cipher/Exception.php';
|
||||
throw new Zend_InfoCard_Cipher_Exception("Use of the AES256CBC Cipher requires the mcrypt extension");
|
||||
}
|
||||
// @codeCoveregIgnoreEnd
|
||||
@ -90,7 +86,7 @@ class Zend_InfoCard_Cipher_Symmetric_Adapter_Aes256cbc
|
||||
public function decrypt($encryptedData, $decryptionKey, $iv_length = null)
|
||||
{
|
||||
|
||||
$iv_length = is_null($iv_length) ? self::IV_LENGTH : $iv_length;
|
||||
$iv_length = ($iv_length === null) ? self::IV_LENGTH : $iv_length;
|
||||
|
||||
$mcrypt_iv = null;
|
||||
|
||||
@ -102,6 +98,7 @@ class Zend_InfoCard_Cipher_Symmetric_Adapter_Aes256cbc
|
||||
$decrypted = mcrypt_decrypt(self::MCRYPT_CIPHER, $decryptionKey, $encryptedData, self::MCRYPT_MODE, $mcrypt_iv);
|
||||
|
||||
if(!$decrypted) {
|
||||
require_once 'Zend/InfoCard/Cipher/Exception.php';
|
||||
throw new Zend_InfoCard_Cipher_Exception("Failed to decrypt data using AES256CBC Algorithm");
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user