web/lib/Zend/InfoCard/Xml/KeyInfo/XmlDSig.php
changeset 64 162c1de6545a
parent 19 1c2f13fd785c
child 68 ecaf28ffe26e
equal deleted inserted replaced
63:5b37998e522e 64:162c1de6545a
       
     1 <?php
       
     2 /**
       
     3  * Zend Framework
       
     4  *
       
     5  * LICENSE
       
     6  *
       
     7  * This source file is subject to the new BSD license that is bundled
       
     8  * with this package in the file LICENSE.txt.
       
     9  * It is also available through the world-wide-web at this URL:
       
    10  * http://framework.zend.com/license/new-bsd
       
    11  * If you did not receive a copy of the license and are unable to
       
    12  * obtain it through the world-wide-web, please send an email
       
    13  * to license@zend.com so we can send you a copy immediately.
       
    14  *
       
    15  * @category   Zend
       
    16  * @package    Zend_InfoCard
       
    17  * @copyright  Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
       
    18  * @license    http://framework.zend.com/license/new-bsd     New BSD License
       
    19  * @version    $Id: XmlDSig.php 20096 2010-01-06 02:05:09Z bkarwin $
       
    20  */
       
    21 
       
    22 /**
       
    23  * Zend_InfoCard_Xml_KeyInfo_Abstract
       
    24  */
       
    25 require_once 'Zend/InfoCard/Xml/KeyInfo/Abstract.php';
       
    26 
       
    27 /**
       
    28  * Zend_InfoCard_Xml_EncryptedKey
       
    29  */
       
    30 require_once 'Zend/InfoCard/Xml/EncryptedKey.php';
       
    31 
       
    32 /**
       
    33  * Zend_InfoCard_Xml_KeyInfo_Interface
       
    34  */
       
    35 require_once 'Zend/InfoCard/Xml/KeyInfo/Interface.php';
       
    36 
       
    37 /**
       
    38  * Represents a Xml Digital Signature XML Data Block
       
    39  *
       
    40  * @category   Zend
       
    41  * @package    Zend_InfoCard
       
    42  * @copyright  Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
       
    43  * @license    http://framework.zend.com/license/new-bsd     New BSD License
       
    44  */
       
    45 class Zend_InfoCard_Xml_KeyInfo_XmlDSig
       
    46     extends Zend_InfoCard_Xml_KeyInfo_Abstract
       
    47     implements Zend_InfoCard_Xml_KeyInfo_Interface
       
    48 {
       
    49     /**
       
    50      * Returns an instance of the EncryptedKey Data Block
       
    51      *
       
    52      * @throws Zend_InfoCard_Xml_Exception
       
    53      * @return Zend_InfoCard_Xml_EncryptedKey
       
    54      */
       
    55     public function getEncryptedKey()
       
    56     {
       
    57         $this->registerXPathNamespace('e', 'http://www.w3.org/2001/04/xmlenc#');
       
    58         list($encryptedkey) = $this->xpath('//e:EncryptedKey');
       
    59 
       
    60         if(!($encryptedkey instanceof Zend_InfoCard_Xml_Element)) {
       
    61             throw new Zend_InfoCard_Xml_Exception("Failed to retrieve encrypted key");
       
    62         }
       
    63 
       
    64         return Zend_InfoCard_Xml_EncryptedKey::getInstance($encryptedkey);
       
    65     }
       
    66 
       
    67     /**
       
    68      * Returns the KeyInfo Block within the encrypted key
       
    69      *
       
    70      * @return Zend_InfoCard_Xml_KeyInfo_Default
       
    71      */
       
    72     public function getKeyInfo()
       
    73     {
       
    74         return $this->getEncryptedKey()->getKeyInfo();
       
    75     }
       
    76 }