summaryrefslogtreecommitdiffstats
path: root/lib/SAML2/XML/ds/KeyInfo.php
diff options
context:
space:
mode:
Diffstat (limited to 'lib/SAML2/XML/ds/KeyInfo.php')
-rw-r--r--lib/SAML2/XML/ds/KeyInfo.php94
1 files changed, 0 insertions, 94 deletions
diff --git a/lib/SAML2/XML/ds/KeyInfo.php b/lib/SAML2/XML/ds/KeyInfo.php
deleted file mode 100644
index 44b4b0d..0000000
--- a/lib/SAML2/XML/ds/KeyInfo.php
+++ /dev/null
@@ -1,94 +0,0 @@
-<?php
-
-/**
- * Class representing a ds:KeyInfo element.
- *
- * @package simpleSAMLphp
- * @version $Id$
- */
-class SAML2_XML_ds_KeyInfo {
-
- /**
- * The Id attribute on this element.
- *
- * @var string|NULL
- */
- public $Id = NULL;
-
-
- /**
- * The various key information elements.
- *
- * Array with various elements describing this key.
- * Unknown elements will be represented by SAML2_XML_Chunk.
- *
- * @var array
- */
- public $info = array();
-
-
- /**
- * Initialize a KeyInfo element.
- *
- * @param DOMElement|NULL $xml The XML element we should load.
- */
- public function __construct(DOMElement $xml = NULL) {
-
- if ($xml === NULL) {
- return;
- }
-
- if ($xml->hasAttribute('Id')) {
- $this->Id = $xml->getAttribute('Id');
- }
-
- for ($n = $xml->firstChild; $n !== NULL; $n = $n->nextSibling) {
- if (!($n instanceof DOMElement)) {
- continue;
- }
-
- if ($n->namespaceURI !== XMLSecurityDSig::XMLDSIGNS) {
- $this->info[] = new SAML2_XML_Chunk($n);
- continue;
- }
- switch ($n->localName) {
- case 'KeyName':
- $this->info[] = new SAML2_XML_ds_KeyName($n);
- break;
- case 'X509Data':
- $this->info[] = new SAML2_XML_ds_X509Data($n);
- break;
- default:
- $this->info[] = new SAML2_XML_Chunk($n);
- break;
- }
- }
- }
-
-
- /**
- * Convert this KeyInfo to XML.
- *
- * @param DOMElement $parent The element we should append this KeyInfo to.
- */
- public function toXML(DOMElement $parent) {
- assert('is_null($this->Id) || is_string($this->Id)');
- assert('is_array($this->info)');
-
- $doc = $parent->ownerDocument;
-
- $e = $doc->createElementNS(XMLSecurityDSig::XMLDSIGNS, 'ds:KeyInfo');
- $parent->appendChild($e);
-
- if (isset($this->Id)) {
- $e->setAttribute('Id', $this->Id);
- }
-
- foreach ($this->info as $n) {
- $n->toXML($e);
- }
-
- return $e;
- }
-
-}