|
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 |
|
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: XmlEnc.php 20096 2010-01-06 02:05:09Z bkarwin $ |
|
21 */ |
|
22 |
|
23 /** |
|
24 * Zend_InfoCard_Xml_EncryptedData/Abstract.php |
|
25 */ |
|
26 require_once 'Zend/InfoCard/Xml/EncryptedData/Abstract.php'; |
|
27 |
|
28 /** |
|
29 * An XmlEnc formatted EncryptedData XML block |
|
30 * |
|
31 * @category Zend |
|
32 * @package Zend_InfoCard |
|
33 * @subpackage Zend_InfoCard_Xml |
|
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_EncryptedData_XmlEnc extends Zend_InfoCard_Xml_EncryptedData_Abstract |
|
38 { |
|
39 |
|
40 /** |
|
41 * Returns the Encrypted CipherValue block from the EncryptedData XML document |
|
42 * |
|
43 * @throws Zend_InfoCard_Xml_Exception |
|
44 * @return string The value of the CipherValue block base64 encoded |
|
45 */ |
|
46 public function getCipherValue() |
|
47 { |
|
48 $this->registerXPathNamespace('enc', 'http://www.w3.org/2001/04/xmlenc#'); |
|
49 |
|
50 list(,$cipherdata) = $this->xpath("//enc:CipherData"); |
|
51 |
|
52 if(!($cipherdata instanceof Zend_InfoCard_Xml_Element)) { |
|
53 throw new Zend_InfoCard_Xml_Exception("Unable to find the enc:CipherData block"); |
|
54 } |
|
55 |
|
56 list(,$ciphervalue) = $cipherdata->xpath("//enc:CipherValue"); |
|
57 |
|
58 if(!($ciphervalue instanceof Zend_InfoCard_Xml_Element)) { |
|
59 throw new Zend_InfoCard_Xml_Exception("Unable to fidn the enc:CipherValue block"); |
|
60 } |
|
61 |
|
62 return (string)$ciphervalue; |
|
63 } |
|
64 } |