web/lib/Zend/Service/Amazon/Authentication/V1.php
changeset 807 877f952ae2bd
parent 207 621fa6caec0c
child 1230 68c69c656a2c
equal deleted inserted replaced
805:5e7a0fedabdf 807:877f952ae2bd
    13  * to license@zend.com so we can send you a copy immediately.
    13  * to license@zend.com so we can send you a copy immediately.
    14  *
    14  *
    15  * @category   Zend
    15  * @category   Zend
    16  * @package    Zend_Service_Amazon
    16  * @package    Zend_Service_Amazon
    17  * @subpackage Authentication
    17  * @subpackage Authentication
    18  * @copyright  Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
    18  * @copyright  Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com)
    19  * @license    http://framework.zend.com/license/new-bsd     New BSD License
    19  * @license    http://framework.zend.com/license/new-bsd     New BSD License
    20  */
    20  */
    21 
    21 
    22 /**
    22 /**
    23  * @see Zend_Service_Amazon_Authentication
    23  * @see Zend_Service_Amazon_Authentication
    31 
    31 
    32 /**
    32 /**
    33  * @category   Zend
    33  * @category   Zend
    34  * @package    Zend_Service_Amazon
    34  * @package    Zend_Service_Amazon
    35  * @subpackage Authentication
    35  * @subpackage Authentication
    36  * @copyright  Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
    36  * @copyright  Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com)
    37  * @license    http://framework.zend.com/license/new-bsd     New BSD License
    37  * @license    http://framework.zend.com/license/new-bsd     New BSD License
    38  */
    38  */
    39 class Zend_Service_Amazon_Authentication_V1 extends Zend_Service_Amazon_Authentication
    39 class Zend_Service_Amazon_Authentication_V1 extends Zend_Service_Amazon_Authentication
    40 {
    40 {
    41     /**
    41     /**
    45 
    45 
    46     /**
    46     /**
    47      * Signature Encoding Method
    47      * Signature Encoding Method
    48      */
    48      */
    49     protected $_signatureMethod = 'HmacSHA256';
    49     protected $_signatureMethod = 'HmacSHA256';
    50     
    50 
    51     /**
    51     /**
    52      * Generate the required attributes for the signature
    52      * Generate the required attributes for the signature
    53      * @param string $url
    53      * @param string $url
    54      * @param array $parameters
    54      * @param array $parameters
    55      * @return string
    55      * @return string
    62         if(!isset($parameters['Timestamp'])) {
    62         if(!isset($parameters['Timestamp'])) {
    63             $parameters['Timestamp']    = gmdate('Y-m-d\TH:i:s\Z', time()+10);
    63             $parameters['Timestamp']    = gmdate('Y-m-d\TH:i:s\Z', time()+10);
    64         }
    64         }
    65 
    65 
    66         $data = $this->_signParameters($url, $parameters);
    66         $data = $this->_signParameters($url, $parameters);
    67         
    67 
    68         return $data;
    68         return $data;
    69     }
    69     }
    70 
    70 
    71     /**
    71     /**
    72      * Computes the RFC 2104-compliant HMAC signature for request parameters
    72      * Computes the RFC 2104-compliant HMAC signature for request parameters
   100         }
   100         }
   101 
   101 
   102         $hmac = Zend_Crypt_Hmac::compute($this->_secretKey, 'SHA1', $data, Zend_Crypt_Hmac::BINARY);
   102         $hmac = Zend_Crypt_Hmac::compute($this->_secretKey, 'SHA1', $data, Zend_Crypt_Hmac::BINARY);
   103 
   103 
   104         $paramaters['Signature'] = base64_encode($hmac);
   104         $paramaters['Signature'] = base64_encode($hmac);
   105         
   105 
   106         return $data;
   106         return $data;
   107     }
   107     }
   108 }
   108 }