ILIAS  release_5-4 Revision v5.4.26-12-gabc799a52e6
SAML2\XML\md\KeyDescriptor Class Reference
+ Collaboration diagram for SAML2\XML\md\KeyDescriptor:

Public Member Functions

 __construct (\DOMElement $xml=null)
 Initialize an KeyDescriptor. More...
 
 toXML (\DOMElement $parent)
 Convert this KeyDescriptor to XML. More...
 

Data Fields

 $use
 
 $KeyInfo
 
 $EncryptionMethod = array()
 

Detailed Description

Definition at line 15 of file KeyDescriptor.php.

Constructor & Destructor Documentation

◆ __construct()

SAML2\XML\md\KeyDescriptor::__construct ( \DOMElement  $xml = null)

Initialize an KeyDescriptor.

Parameters
\DOMElement | null$xmlThe XML element we should load.
Exceptions

Definition at line 48 of file KeyDescriptor.php.

References $xml, and SAML2\Utils\xpQuery().

49  {
50  if ($xml === null) {
51  return;
52  }
53 
54  if ($xml->hasAttribute('use')) {
55  $this->use = $xml->getAttribute('use');
56  }
57 
58  $keyInfo = Utils::xpQuery($xml, './ds:KeyInfo');
59  if (count($keyInfo) > 1) {
60  throw new \Exception('More than one ds:KeyInfo in the KeyDescriptor.');
61  } elseif (empty($keyInfo)) {
62  throw new \Exception('No ds:KeyInfo in the KeyDescriptor.');
63  }
64  $this->KeyInfo = new KeyInfo($keyInfo[0]);
65 
66  foreach (Utils::xpQuery($xml, './saml_metadata:EncryptionMethod') as $em) {
67  $this->EncryptionMethod[] = new Chunk($em);
68  }
69  }
static xpQuery(\DOMNode $node, $query)
Do an XPath query on an XML node.
Definition: Utils.php:191
+ Here is the call graph for this function:

Member Function Documentation

◆ toXML()

SAML2\XML\md\KeyDescriptor::toXML ( \DOMElement  $parent)

Convert this KeyDescriptor to XML.

Parameters
\DOMElement$parentThe element we should append this KeyDescriptor to.
Returns

Definition at line 77 of file KeyDescriptor.php.

References SAML2\Constants\NS_MD.

78  {
79  assert(is_null($this->use) || is_string($this->use));
80  assert($this->KeyInfo instanceof KeyInfo);
81  assert(is_array($this->EncryptionMethod));
82 
83  $doc = $parent->ownerDocument;
84 
85  $e = $doc->createElementNS(Constants::NS_MD, 'md:KeyDescriptor');
86  $parent->appendChild($e);
87 
88  if (isset($this->use)) {
89  $e->setAttribute('use', $this->use);
90  }
91 
92  $this->KeyInfo->toXML($e);
93 
94  foreach ($this->EncryptionMethod as $em) {
95  $em->toXML($e);
96  }
97 
98  return $e;
99  }
const NS_MD
The namespace for the SAML 2 metadata.
Definition: Constants.php:230

Field Documentation

◆ $EncryptionMethod

SAML2\XML\md\KeyDescriptor::$EncryptionMethod = array()

Definition at line 40 of file KeyDescriptor.php.

◆ $KeyInfo

SAML2\XML\md\KeyDescriptor::$KeyInfo

Definition at line 31 of file KeyDescriptor.php.

◆ $use

SAML2\XML\md\KeyDescriptor::$use

Definition at line 24 of file KeyDescriptor.php.


The documentation for this class was generated from the following file: