XmlDSig.php 2.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576
  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-2012 Zend Technologies USA Inc. (http://www.zend.com)
  18. * @license http://framework.zend.com/license/new-bsd New BSD License
  19. * @version $Id$
  20. */
  21. /**
  22. * Zend_InfoCard_Xml_KeyInfo_Abstract
  23. */
  24. require_once 'Zend/InfoCard/Xml/KeyInfo/Abstract.php';
  25. /**
  26. * Zend_InfoCard_Xml_EncryptedKey
  27. */
  28. require_once 'Zend/InfoCard/Xml/EncryptedKey.php';
  29. /**
  30. * Zend_InfoCard_Xml_KeyInfo_Interface
  31. */
  32. require_once 'Zend/InfoCard/Xml/KeyInfo/Interface.php';
  33. /**
  34. * Represents a Xml Digital Signature XML Data Block
  35. *
  36. * @category Zend
  37. * @package Zend_InfoCard
  38. * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com)
  39. * @license http://framework.zend.com/license/new-bsd New BSD License
  40. */
  41. class Zend_InfoCard_Xml_KeyInfo_XmlDSig
  42. extends Zend_InfoCard_Xml_KeyInfo_Abstract
  43. implements Zend_InfoCard_Xml_KeyInfo_Interface
  44. {
  45. /**
  46. * Returns an instance of the EncryptedKey Data Block
  47. *
  48. * @throws Zend_InfoCard_Xml_Exception
  49. * @return Zend_InfoCard_Xml_EncryptedKey
  50. */
  51. public function getEncryptedKey()
  52. {
  53. $this->registerXPathNamespace('e', 'http://www.w3.org/2001/04/xmlenc#');
  54. list($encryptedkey) = $this->xpath('//e:EncryptedKey');
  55. if(!($encryptedkey instanceof Zend_InfoCard_Xml_Element)) {
  56. throw new Zend_InfoCard_Xml_Exception("Failed to retrieve encrypted key");
  57. }
  58. return Zend_InfoCard_Xml_EncryptedKey::getInstance($encryptedkey);
  59. }
  60. /**
  61. * Returns the KeyInfo Block within the encrypted key
  62. *
  63. * @return Zend_InfoCard_Xml_KeyInfo_Default
  64. */
  65. public function getKeyInfo()
  66. {
  67. return $this->getEncryptedKey()->getKeyInfo();
  68. }
  69. }