web/Zend/InfoCard/Xml/Security/Transform/EnvelopedSignature.php
changeset 0 4eba9c11703f
equal deleted inserted replaced
-1:000000000000 0:4eba9c11703f
       
     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  * @subpackage Zend_InfoCard_Xml_Security
       
    18  * @copyright  Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
       
    19  * @license    http://framework.zend.com/license/new-bsd     New BSD License
       
    20  * @version    $Id: EnvelopedSignature.php 20096 2010-01-06 02:05:09Z bkarwin $
       
    21  */
       
    22 
       
    23 /**
       
    24  * Zend_InfoCard_Xml_Security_Transform_Interface
       
    25  */
       
    26 require_once 'Zend/InfoCard/Xml/Security/Transform/Interface.php';
       
    27 
       
    28 /**
       
    29  * A object implementing the EnvelopedSignature XML Transform
       
    30  *
       
    31  * @category   Zend
       
    32  * @package    Zend_InfoCard
       
    33  * @subpackage Zend_InfoCard_Xml_Security
       
    34  * @copyright  Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
       
    35  * @license    http://framework.zend.com/license/new-bsd     New BSD License
       
    36  */
       
    37 class Zend_InfoCard_Xml_Security_Transform_EnvelopedSignature
       
    38     implements Zend_InfoCard_Xml_Security_Transform_Interface
       
    39 {
       
    40     /**
       
    41      * Transforms the XML Document according to the EnvelopedSignature Transform
       
    42      *
       
    43      * @throws Zend_InfoCard_Xml_Security_Transform_Exception
       
    44      * @param string $strXMLData The input XML data
       
    45      * @return string the transformed XML data
       
    46      */
       
    47     public function transform($strXMLData)
       
    48     {
       
    49         $sxe = simplexml_load_string($strXMLData);
       
    50 
       
    51         if(!$sxe->Signature) {
       
    52             require_once 'Zend/InfoCard/Xml/Security/Transform/Exception.php';
       
    53             throw new Zend_InfoCard_Xml_Security_Transform_Exception("Unable to locate Signature Block for EnvelopedSignature Transform");
       
    54         }
       
    55 
       
    56         unset($sxe->Signature);
       
    57 
       
    58         return $sxe->asXML();
       
    59     }
       
    60 }