summaryrefslogtreecommitdiffstats
path: root/lib/SAML2/XML/md/KeyDescriptor.php
diff options
context:
space:
mode:
authorOlav Morken <olav.morken@uninett.no>2013-11-15 09:34:07 +0000
committerOlav Morken <olav.morken@uninett.no>2013-11-15 09:34:07 +0000
commit6f61aef12c6b1b02e32da6d1c696bee6d5f1e4dc (patch)
treef1d6c78ab5e2eec5f8b8121f9e1a838c28997fa6 /lib/SAML2/XML/md/KeyDescriptor.php
parente9c98e008ed7dbb5d642aa4788edd2510c952ca1 (diff)
downloadsimplesamlphp-6f61aef12c6b1b02e32da6d1c696bee6d5f1e4dc.zip
simplesamlphp-6f61aef12c6b1b02e32da6d1c696bee6d5f1e4dc.tar.gz
simplesamlphp-6f61aef12c6b1b02e32da6d1c696bee6d5f1e4dc.tar.bz2
Start using SAML2 library from GitHub.
This patch also starts using Composer for other dependencies (i.e. php-openid and xmlseclibs). Thanks to Boy Baukema for implementing this! git-svn-id: https://simplesamlphp.googlecode.com/svn/trunk@3290 44740490-163a-0410-bde0-09ae8108e29a
Diffstat (limited to 'lib/SAML2/XML/md/KeyDescriptor.php')
-rw-r--r--lib/SAML2/XML/md/KeyDescriptor.php97
1 files changed, 0 insertions, 97 deletions
diff --git a/lib/SAML2/XML/md/KeyDescriptor.php b/lib/SAML2/XML/md/KeyDescriptor.php
deleted file mode 100644
index aeaffe9..0000000
--- a/lib/SAML2/XML/md/KeyDescriptor.php
+++ /dev/null
@@ -1,97 +0,0 @@
-<?php
-
-/**
- * Class representing a KeyDescriptor element.
- *
- * @package simpleSAMLphp
- * @version $Id$
- */
-class SAML2_XML_md_KeyDescriptor {
-
- /**
- * What this key can be used for.
- *
- * 'encryption', 'signing' or NULL.
- *
- * @var string|NULL
- */
- public $use;
-
-
- /**
- * The KeyInfo for this key.
- *
- * @var SAML2_XML_ds_KeyInfo
- */
- public $KeyInfo;
-
-
- /**
- * Supported EncryptionMethods.
- *
- * Array of SAML2_XML_Chunk objects.
- *
- * @var array
- */
- public $EncryptionMethod = array();
-
-
- /**
- * Initialize an KeyDescriptor.
- *
- * @param DOMElement|NULL $xml The XML element we should load.
- */
- public function __construct(DOMElement $xml = NULL) {
-
- if ($xml === NULL) {
- return;
- }
-
- if ($xml->hasAttribute('use')) {
- $this->use = $xml->getAttribute('use');
- }
-
- $keyInfo = SAML2_Utils::xpQuery($xml, './ds:KeyInfo');
- if (count($keyInfo) > 1) {
- throw new Exception('More than one ds:KeyInfo in the KeyDescriptor.');
- } elseif (empty($keyInfo)) {
- throw new Exception('No ds:KeyInfo in the KeyDescriptor.');
- }
- $this->KeyInfo = new SAML2_XML_ds_KeyInfo($keyInfo[0]);
-
- foreach (SAML2_Utils::xpQuery($xml, './saml_metadata:EncryptionMethod') as $em) {
- $this->EncryptionMethod[] = new SAML2_XML_Chunk($em);
- }
-
- }
-
-
- /**
- * Convert this KeyDescriptor to XML.
- *
- * @param DOMElement $parent The element we should append this KeyDescriptor to.
- */
- public function toXML(DOMElement $parent) {
- assert('is_null($this->use) || is_string($this->use)');
- assert('$this->KeyInfo instanceof SAML2_XML_ds_KeyInfo');
- assert('is_array($this->EncryptionMethod)');
-
- $doc = $parent->ownerDocument;
-
- $e = $doc->createElementNS(SAML2_Const::NS_MD, 'md:KeyDescriptor');
- $parent->appendChild($e);
-
- if (isset($this->use)) {
- $e->setAttribute('use', $this->use);
- }
-
- $this->KeyInfo->toXML($e);
-
- foreach ($this->EncryptionMethod as $em) {
- $em->toXML($e);
- }
-
- return $e;
- }
-
-}