import v1.0.0-RC4 | 2009-05-20
This commit is contained in:
38
libs/Zend/InfoCard/Cipher/Exception.php
Normal file
38
libs/Zend/InfoCard/Cipher/Exception.php
Normal file
@ -0,0 +1,38 @@
|
||||
<?php
|
||||
/**
|
||||
* Zend Framework
|
||||
*
|
||||
* LICENSE
|
||||
*
|
||||
* This source file is subject to the new BSD license that is bundled
|
||||
* with this package in the file LICENSE.txt.
|
||||
* It is also available through the world-wide-web at this URL:
|
||||
* http://framework.zend.com/license/new-bsd
|
||||
* If you did not receive a copy of the license and are unable to
|
||||
* obtain it through the world-wide-web, please send an email
|
||||
* to license@zend.com so we can send you a copy immediately.
|
||||
*
|
||||
* @category Zend
|
||||
* @package Zend_InfoCard
|
||||
* @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: Exception.php 9094 2008-03-30 18:36:55Z thomas $
|
||||
*/
|
||||
|
||||
/**
|
||||
* Zend_InfoCard_Exception
|
||||
*/
|
||||
require_once 'Zend/InfoCard/Exception.php';
|
||||
|
||||
|
||||
/**
|
||||
* @category Zend
|
||||
* @package Zend_InfoCard
|
||||
* @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
|
||||
*/
|
||||
class Zend_InfoCard_Cipher_Exception extends Zend_InfoCard_Exception
|
||||
{
|
||||
}
|
91
libs/Zend/InfoCard/Cipher/Pki/Adapter/Abstract.php
Normal file
91
libs/Zend/InfoCard/Cipher/Pki/Adapter/Abstract.php
Normal file
@ -0,0 +1,91 @@
|
||||
<?php
|
||||
/**
|
||||
* Zend Framework
|
||||
*
|
||||
* LICENSE
|
||||
*
|
||||
* This source file is subject to the new BSD license that is bundled
|
||||
* with this package in the file LICENSE.txt.
|
||||
* It is also available through the world-wide-web at this URL:
|
||||
* http://framework.zend.com/license/new-bsd
|
||||
* If you did not receive a copy of the license and are unable to
|
||||
* obtain it through the world-wide-web, please send an email
|
||||
* to license@zend.com so we can send you a copy immediately.
|
||||
*
|
||||
* @category Zend
|
||||
* @package Zend_InfoCard
|
||||
* @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 $
|
||||
*/
|
||||
|
||||
/**
|
||||
* Zend_InfoCard_Cipher_Pki_Interface
|
||||
*/
|
||||
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
|
||||
*
|
||||
* @category Zend
|
||||
* @package Zend_InfoCard
|
||||
* @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
|
||||
*/
|
||||
abstract class Zend_InfoCard_Cipher_Pki_Adapter_Abstract implements Zend_InfoCard_Cipher_Pki_Interface
|
||||
{
|
||||
/**
|
||||
* OAEP Padding public key encryption
|
||||
*/
|
||||
const OAEP_PADDING = 1;
|
||||
|
||||
/**
|
||||
* No padding public key encryption
|
||||
*/
|
||||
const NO_PADDING = 2;
|
||||
|
||||
/**
|
||||
* The type of padding to use
|
||||
*
|
||||
* @var integer one of the padding constants in this class
|
||||
*/
|
||||
protected $_padding;
|
||||
|
||||
/**
|
||||
* Set the padding of the public key encryption
|
||||
*
|
||||
* @throws Zend_InfoCard_Cipher_Exception
|
||||
* @param integer $padding One of the constnats in this class
|
||||
* @return Zend_InfoCard_Pki_Adapter_Abstract
|
||||
*/
|
||||
public function setPadding($padding)
|
||||
{
|
||||
switch($padding) {
|
||||
case self::OAEP_PADDING:
|
||||
case self::NO_PADDING:
|
||||
$this->_padding = $padding;
|
||||
break;
|
||||
default:
|
||||
throw new Zend_InfoCard_Cipher_Exception("Invalid Padding Type Provided");
|
||||
}
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Retruns the public-key padding used
|
||||
*
|
||||
* @return integer One of the padding constants in this class
|
||||
*/
|
||||
public function getPadding()
|
||||
{
|
||||
return $this->_padding;
|
||||
}
|
||||
}
|
117
libs/Zend/InfoCard/Cipher/Pki/Adapter/Rsa.php
Normal file
117
libs/Zend/InfoCard/Cipher/Pki/Adapter/Rsa.php
Normal file
@ -0,0 +1,117 @@
|
||||
<?php
|
||||
/**
|
||||
* Zend Framework
|
||||
*
|
||||
* LICENSE
|
||||
*
|
||||
* This source file is subject to the new BSD license that is bundled
|
||||
* with this package in the file LICENSE.txt.
|
||||
* It is also available through the world-wide-web at this URL:
|
||||
* http://framework.zend.com/license/new-bsd
|
||||
* If you did not receive a copy of the license and are unable to
|
||||
* obtain it through the world-wide-web, please send an email
|
||||
* to license@zend.com so we can send you a copy immediately.
|
||||
*
|
||||
* @category Zend
|
||||
* @package Zend_InfoCard
|
||||
* @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 $
|
||||
*/
|
||||
|
||||
/**
|
||||
* Zend_InfoCard_Cipher_Pki_Adapter_Abstract
|
||||
*/
|
||||
require_once 'Zend/InfoCard/Cipher/Pki/Adapter/Abstract.php';
|
||||
|
||||
/**
|
||||
* Zend_InfoCard_Cipher_Pki_Rsa_Interface
|
||||
*/
|
||||
require_once 'Zend/InfoCard/Cipher/Pki/Rsa/Interface.php';
|
||||
|
||||
/**
|
||||
* RSA Public Key Encryption Cipher Object for the InfoCard component. Relies on OpenSSL
|
||||
* to implement the RSA algorithm
|
||||
*
|
||||
* @category Zend
|
||||
* @package Zend_InfoCard
|
||||
* @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
|
||||
*/
|
||||
class Zend_InfoCard_Cipher_Pki_Adapter_Rsa
|
||||
extends Zend_InfoCard_Cipher_Pki_Adapter_Abstract
|
||||
implements Zend_InfoCard_Cipher_Pki_Rsa_Interface
|
||||
{
|
||||
|
||||
/**
|
||||
* Object Constructor
|
||||
*
|
||||
* @param integer $padding The type of Padding to use
|
||||
*/
|
||||
public function __construct($padding = Zend_InfoCard_Cipher_Pki_Adapter_Abstract::NO_PADDING)
|
||||
{
|
||||
// Can't test this..
|
||||
// @codeCoverageIgnoreStart
|
||||
if(!extension_loaded('openssl')) {
|
||||
throw new Zend_InfoCard_Cipher_Exception("Use of this PKI RSA Adapter requires the openssl extension loaded");
|
||||
}
|
||||
// @codeCoverageIgnoreEnd
|
||||
|
||||
$this->setPadding($padding);
|
||||
}
|
||||
|
||||
/**
|
||||
* Decrypts RSA encrypted data using the given private key
|
||||
*
|
||||
* @throws Zend_InfoCard_Cipher_Exception
|
||||
* @param string $encryptedData The encrypted data in binary format
|
||||
* @param string $privateKey The private key in binary format
|
||||
* @param string $password The private key passphrase
|
||||
* @param integer $padding The padding to use during decryption (of not provided object value will be used)
|
||||
* @return string The decrypted data
|
||||
*/
|
||||
public function decrypt($encryptedData, $privateKey, $password = null, $padding = null)
|
||||
{
|
||||
$private_key = openssl_pkey_get_private(array($privateKey, $password));
|
||||
|
||||
if(!$private_key) {
|
||||
throw new Zend_InfoCard_Cipher_Exception("Failed to load private key");
|
||||
}
|
||||
|
||||
if(!is_null($padding)) {
|
||||
try {
|
||||
$this->setPadding($padding);
|
||||
} catch(Exception $e) {
|
||||
openssl_free_key($private_key);
|
||||
throw $e;
|
||||
}
|
||||
}
|
||||
|
||||
switch($this->getPadding()) {
|
||||
case self::NO_PADDING:
|
||||
$openssl_padding = OPENSSL_NO_PADDING;
|
||||
break;
|
||||
case self::OAEP_PADDING:
|
||||
$openssl_padding = OPENSSL_PKCS1_OAEP_PADDING;
|
||||
break;
|
||||
}
|
||||
|
||||
$result = openssl_private_decrypt($encryptedData, $decryptedData, $private_key, $openssl_padding);
|
||||
|
||||
openssl_free_key($private_key);
|
||||
|
||||
if(!$result) {
|
||||
throw new Zend_InfoCard_Cipher_Exception("Unable to Decrypt Value using provided private key");
|
||||
}
|
||||
|
||||
if($this->getPadding() == self::NO_PADDING) {
|
||||
$decryptedData = substr($decryptedData, 2);
|
||||
$start = strpos($decryptedData, 0) + 1;
|
||||
$decryptedData = substr($decryptedData, $start);
|
||||
}
|
||||
|
||||
return $decryptedData;
|
||||
}
|
||||
}
|
33
libs/Zend/InfoCard/Cipher/Pki/Interface.php
Normal file
33
libs/Zend/InfoCard/Cipher/Pki/Interface.php
Normal file
@ -0,0 +1,33 @@
|
||||
<?php
|
||||
/**
|
||||
* Zend Framework
|
||||
*
|
||||
* LICENSE
|
||||
*
|
||||
* This source file is subject to the new BSD license that is bundled
|
||||
* with this package in the file LICENSE.txt.
|
||||
* It is also available through the world-wide-web at this URL:
|
||||
* http://framework.zend.com/license/new-bsd
|
||||
* If you did not receive a copy of the license and are unable to
|
||||
* obtain it through the world-wide-web, please send an email
|
||||
* to license@zend.com so we can send you a copy immediately.
|
||||
*
|
||||
* @category Zend
|
||||
* @package Zend_InfoCard
|
||||
* @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: Interface.php 9094 2008-03-30 18:36:55Z thomas $
|
||||
*/
|
||||
|
||||
/**
|
||||
* Empty Interface represents a Pki cipher object
|
||||
* @category Zend
|
||||
* @package Zend_InfoCard
|
||||
* @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
|
||||
*/
|
||||
interface Zend_InfoCard_Cipher_Pki_Interface
|
||||
{
|
||||
}
|
50
libs/Zend/InfoCard/Cipher/Pki/Rsa/Interface.php
Normal file
50
libs/Zend/InfoCard/Cipher/Pki/Rsa/Interface.php
Normal file
@ -0,0 +1,50 @@
|
||||
<?php
|
||||
/**
|
||||
* Zend Framework
|
||||
*
|
||||
* LICENSE
|
||||
*
|
||||
* This source file is subject to the new BSD license that is bundled
|
||||
* with this package in the file LICENSE.txt.
|
||||
* It is also available through the world-wide-web at this URL:
|
||||
* http://framework.zend.com/license/new-bsd
|
||||
* If you did not receive a copy of the license and are unable to
|
||||
* obtain it through the world-wide-web, please send an email
|
||||
* to license@zend.com so we can send you a copy immediately.
|
||||
*
|
||||
* @category Zend
|
||||
* @package Zend_InfoCard
|
||||
* @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: Interface.php 9094 2008-03-30 18:36:55Z thomas $
|
||||
*/
|
||||
|
||||
/**
|
||||
* Zend_InfoCard_Cipher_PKI_Adapter_Abstract
|
||||
*/
|
||||
require_once 'Zend/InfoCard/Cipher/Pki/Adapter/Abstract.php';
|
||||
|
||||
/**
|
||||
* The interface which defines the RSA Public-key encryption object
|
||||
*
|
||||
* @category Zend
|
||||
* @package Zend_InfoCard
|
||||
* @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
|
||||
*/
|
||||
interface Zend_InfoCard_Cipher_Pki_Rsa_Interface
|
||||
{
|
||||
/**
|
||||
* Decrypts RSA encrypted data using the given private key
|
||||
*
|
||||
* @throws Zend_InfoCard_Cipher_Exception
|
||||
* @param string $encryptedData The encrypted data in binary format
|
||||
* @param string $privateKey The private key in binary format
|
||||
* @param string $password The private key passphrase
|
||||
* @param integer $padding The padding to use during decryption (of not provided object value will be used)
|
||||
* @return string The decrypted data
|
||||
*/
|
||||
public function decrypt($encryptedData, $privateKey, $password = null, $padding = Zend_InfoCard_Cipher_Pki_Adapter_Abstract::NO_PADDING);
|
||||
}
|
38
libs/Zend/InfoCard/Cipher/Symmetric/Adapter/Abstract.php
Normal file
38
libs/Zend/InfoCard/Cipher/Symmetric/Adapter/Abstract.php
Normal file
@ -0,0 +1,38 @@
|
||||
<?php
|
||||
/**
|
||||
* Zend Framework
|
||||
*
|
||||
* LICENSE
|
||||
*
|
||||
* This source file is subject to the new BSD license that is bundled
|
||||
* with this package in the file LICENSE.txt.
|
||||
* It is also available through the world-wide-web at this URL:
|
||||
* http://framework.zend.com/license/new-bsd
|
||||
* If you did not receive a copy of the license and are unable to
|
||||
* obtain it through the world-wide-web, please send an email
|
||||
* to license@zend.com so we can send you a copy immediately.
|
||||
*
|
||||
* @category Zend
|
||||
* @package Zend_InfoCard
|
||||
* @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 $
|
||||
*/
|
||||
|
||||
/**
|
||||
* Zend_InfoCard_Cipher_Symmetric_Interface
|
||||
*/
|
||||
require_once 'Zend/InfoCard/Cipher/Symmetric/Interface.php';
|
||||
|
||||
/**
|
||||
* @category Zend
|
||||
* @package Zend_InfoCard
|
||||
* @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
|
||||
*/
|
||||
abstract class Zend_InfoCard_Cipher_Symmetric_Adapter_Abstract
|
||||
implements Zend_InfoCard_Cipher_Symmetric_Interface
|
||||
{
|
||||
}
|
40
libs/Zend/InfoCard/Cipher/Symmetric/Adapter/Aes128cbc.php
Normal file
40
libs/Zend/InfoCard/Cipher/Symmetric/Adapter/Aes128cbc.php
Normal file
@ -0,0 +1,40 @@
|
||||
<?php
|
||||
/**
|
||||
* Zend Framework
|
||||
*
|
||||
* LICENSE
|
||||
*
|
||||
* This source file is subject to the new BSD license that is bundled
|
||||
* with this package in the file LICENSE.txt.
|
||||
* It is also available through the world-wide-web at this URL:
|
||||
* http://framework.zend.com/license/new-bsd
|
||||
* If you did not receive a copy of the license and are unable to
|
||||
* obtain it through the world-wide-web, please send an email
|
||||
* to license@zend.com so we can send you a copy immediately.
|
||||
*
|
||||
* @category Zend
|
||||
* @package Zend_InfoCard
|
||||
* @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: Aes128cbc.php 9094 2008-03-30 18:36:55Z thomas $
|
||||
*/
|
||||
|
||||
/**
|
||||
* Zend_InfoCard_Cipher_Symmetric_Adapter_Aes256cbc
|
||||
*/
|
||||
require_once 'Zend/InfoCard/Cipher/Symmetric/Adapter/Aes256cbc.php';
|
||||
|
||||
/**
|
||||
* Implements AES128 with CBC encryption implemented using the mCrypt extension
|
||||
*
|
||||
* @category Zend
|
||||
* @package Zend_InfoCard
|
||||
* @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
|
||||
*/
|
||||
class Zend_InfoCard_Cipher_Symmetric_Adapter_Aes128cbc
|
||||
extends Zend_InfoCard_Cipher_Symmetric_Adapter_Aes256cbc
|
||||
{
|
||||
}
|
114
libs/Zend/InfoCard/Cipher/Symmetric/Adapter/Aes256cbc.php
Normal file
114
libs/Zend/InfoCard/Cipher/Symmetric/Adapter/Aes256cbc.php
Normal file
@ -0,0 +1,114 @@
|
||||
<?php
|
||||
/**
|
||||
* Zend Framework
|
||||
*
|
||||
* LICENSE
|
||||
*
|
||||
* This source file is subject to the new BSD license that is bundled
|
||||
* with this package in the file LICENSE.txt.
|
||||
* It is also available through the world-wide-web at this URL:
|
||||
* http://framework.zend.com/license/new-bsd
|
||||
* If you did not receive a copy of the license and are unable to
|
||||
* obtain it through the world-wide-web, please send an email
|
||||
* to license@zend.com so we can send you a copy immediately.
|
||||
*
|
||||
* @category Zend
|
||||
* @package Zend_InfoCard
|
||||
* @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 $
|
||||
*/
|
||||
|
||||
/**
|
||||
* Zend_InfoCard_Cipher_Symmetric_Adapter_Abstract
|
||||
*/
|
||||
require_once 'Zend/InfoCard/Cipher/Symmetric/Adapter/Abstract.php';
|
||||
|
||||
/**
|
||||
* Zend_InfoCard_Cipher_Symmetric_Aes256cbc_Interface
|
||||
*/
|
||||
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
|
||||
*
|
||||
* @category Zend
|
||||
* @package Zend_InfoCard
|
||||
* @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
|
||||
*/
|
||||
class Zend_InfoCard_Cipher_Symmetric_Adapter_Aes256cbc
|
||||
extends Zend_InfoCard_Cipher_Symmetric_Adapter_Abstract
|
||||
implements Zend_InfoCard_Cipher_Symmetric_Aes256cbc_Interface
|
||||
{
|
||||
/**
|
||||
* The MCRYPT Cipher constant for this encryption
|
||||
*/
|
||||
const MCRYPT_CIPHER = MCRYPT_RIJNDAEL_128;
|
||||
|
||||
/**
|
||||
* The MCRYPT Mode constant for this encryption
|
||||
*/
|
||||
const MCRYPT_MODE = MCRYPT_MODE_CBC;
|
||||
|
||||
/**
|
||||
* The default length of the IV to use
|
||||
*/
|
||||
const IV_LENGTH = 16;
|
||||
|
||||
/**
|
||||
* The object constructor
|
||||
*
|
||||
* @throws Zend_InfoCard_Cipher_Exception
|
||||
*/
|
||||
public function __construct()
|
||||
{
|
||||
// Can't test for this
|
||||
// @codeCoverageIgnoreStart
|
||||
if(!extension_loaded('mcrypt')) {
|
||||
throw new Zend_InfoCard_Cipher_Exception("Use of the AES256CBC Cipher requires the mcrypt extension");
|
||||
}
|
||||
// @codeCoveregIgnoreEnd
|
||||
}
|
||||
|
||||
/**
|
||||
* Decrypts data using the AES Algorithm using the mCrypt extension
|
||||
*
|
||||
* @throws Zend_InfoCard_Cipher_Exception
|
||||
* @param string $encryptedData The encrypted data in binary format
|
||||
* @param string $decryptionKey The decryption key
|
||||
* @param integer $iv_length The IV length to use
|
||||
* @return string the decrypted data with any terminating nulls removed
|
||||
*/
|
||||
public function decrypt($encryptedData, $decryptionKey, $iv_length = null)
|
||||
{
|
||||
|
||||
$iv_length = is_null($iv_length) ? self::IV_LENGTH : $iv_length;
|
||||
|
||||
$mcrypt_iv = null;
|
||||
|
||||
if($iv_length > 0) {
|
||||
$mcrypt_iv = substr($encryptedData, 0, $iv_length);
|
||||
$encryptedData = substr($encryptedData, $iv_length);
|
||||
}
|
||||
|
||||
$decrypted = mcrypt_decrypt(self::MCRYPT_CIPHER, $decryptionKey, $encryptedData, self::MCRYPT_MODE, $mcrypt_iv);
|
||||
|
||||
if(!$decrypted) {
|
||||
throw new Zend_InfoCard_Cipher_Exception("Failed to decrypt data using AES256CBC Algorithm");
|
||||
}
|
||||
|
||||
$decryptedLength = strlen($decrypted);
|
||||
$paddingLength = substr($decrypted, $decryptedLength -1, 1);
|
||||
$decrypted = substr($decrypted, 0, $decryptedLength - ord($paddingLength));
|
||||
|
||||
return rtrim($decrypted, "\0");
|
||||
}
|
||||
}
|
38
libs/Zend/InfoCard/Cipher/Symmetric/Aes128cbc/Interface.php
Normal file
38
libs/Zend/InfoCard/Cipher/Symmetric/Aes128cbc/Interface.php
Normal file
@ -0,0 +1,38 @@
|
||||
<?php
|
||||
/**
|
||||
* Zend Framework
|
||||
*
|
||||
* LICENSE
|
||||
*
|
||||
* This source file is subject to the new BSD license that is bundled
|
||||
* with this package in the file LICENSE.txt.
|
||||
* It is also available through the world-wide-web at this URL:
|
||||
* http://framework.zend.com/license/new-bsd
|
||||
* If you did not receive a copy of the license and are unable to
|
||||
* obtain it through the world-wide-web, please send an email
|
||||
* to license@zend.com so we can send you a copy immediately.
|
||||
*
|
||||
* @category Zend
|
||||
* @package Zend_InfoCard
|
||||
* @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: Interface.php 9094 2008-03-30 18:36:55Z thomas $
|
||||
*/
|
||||
|
||||
/**
|
||||
* Zend_InfoCard_Cipher_Symmetric_Aes256cbc_Interface
|
||||
*/
|
||||
require_once 'Zend/InfoCard/Cipher/Symmetric/Aes256cbc/Interface.php';
|
||||
|
||||
/**
|
||||
* @category Zend
|
||||
* @package Zend_InfoCard
|
||||
* @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
|
||||
*/
|
||||
interface Zend_InfoCard_Cipher_Symmetric_Aes128cbc_Interface
|
||||
extends Zend_InfoCard_Cipher_Symmetric_Aes256cbc_Interface
|
||||
{
|
||||
}
|
33
libs/Zend/InfoCard/Cipher/Symmetric/Aes256cbc/Interface.php
Normal file
33
libs/Zend/InfoCard/Cipher/Symmetric/Aes256cbc/Interface.php
Normal file
@ -0,0 +1,33 @@
|
||||
<?php
|
||||
/**
|
||||
* Zend Framework
|
||||
*
|
||||
* LICENSE
|
||||
*
|
||||
* This source file is subject to the new BSD license that is bundled
|
||||
* with this package in the file LICENSE.txt.
|
||||
* It is also available through the world-wide-web at this URL:
|
||||
* http://framework.zend.com/license/new-bsd
|
||||
* If you did not receive a copy of the license and are unable to
|
||||
* obtain it through the world-wide-web, please send an email
|
||||
* to license@zend.com so we can send you a copy immediately.
|
||||
*
|
||||
* @category Zend
|
||||
* @package Zend_InfoCard
|
||||
* @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: Interface.php 9094 2008-03-30 18:36:55Z thomas $
|
||||
*/
|
||||
|
||||
/**
|
||||
* @category Zend
|
||||
* @package Zend_InfoCard
|
||||
* @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
|
||||
*/
|
||||
interface Zend_InfoCard_Cipher_Symmetric_Aes256cbc_Interface
|
||||
{
|
||||
public function decrypt($encryptedData, $decryptionKey, $iv_length = null);
|
||||
}
|
32
libs/Zend/InfoCard/Cipher/Symmetric/Interface.php
Normal file
32
libs/Zend/InfoCard/Cipher/Symmetric/Interface.php
Normal file
@ -0,0 +1,32 @@
|
||||
<?php
|
||||
/**
|
||||
* Zend Framework
|
||||
*
|
||||
* LICENSE
|
||||
*
|
||||
* This source file is subject to the new BSD license that is bundled
|
||||
* with this package in the file LICENSE.txt.
|
||||
* It is also available through the world-wide-web at this URL:
|
||||
* http://framework.zend.com/license/new-bsd
|
||||
* If you did not receive a copy of the license and are unable to
|
||||
* obtain it through the world-wide-web, please send an email
|
||||
* to license@zend.com so we can send you a copy immediately.
|
||||
*
|
||||
* @category Zend
|
||||
* @package Zend_InfoCard
|
||||
* @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: Interface.php 9094 2008-03-30 18:36:55Z thomas $
|
||||
*/
|
||||
|
||||
/**
|
||||
* @category Zend
|
||||
* @package Zend_InfoCard
|
||||
* @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
|
||||
*/
|
||||
interface Zend_InfoCard_Cipher_Symmetric_Interface
|
||||
{
|
||||
}
|
Reference in New Issue
Block a user