1
|
|
|
<?php |
2
|
|
|
|
3
|
|
|
declare(strict_types=1); |
4
|
|
|
|
5
|
|
|
namespace SimpleSAML\XMLSecurity\XML\ds; |
6
|
|
|
|
7
|
|
|
use DOMElement; |
8
|
|
|
use SimpleSAML\Assert\Assert; |
9
|
|
|
use SimpleSAML\XML\Exception\InvalidDOMElementException; |
10
|
|
|
|
11
|
|
|
use function array_merge; |
12
|
|
|
|
13
|
|
|
/** |
14
|
|
|
* Class representing a ds:KeyInfo element. |
15
|
|
|
* |
16
|
|
|
* @package simplesamlphp/xml-security |
17
|
|
|
*/ |
18
|
|
|
final class KeyInfo extends AbstractKeyInfoType |
19
|
|
|
{ |
20
|
|
|
/** |
21
|
|
|
* Convert XML into a KeyInfo |
22
|
|
|
* |
23
|
|
|
* @param \DOMElement $xml The XML element we should load |
24
|
|
|
* @return static |
25
|
|
|
* |
26
|
|
|
* @throws \SimpleSAML\XML\Exception\InvalidDOMElementException |
27
|
|
|
* If the qualified name of the supplied element is wrong |
28
|
|
|
*/ |
29
|
|
|
public static function fromXML(DOMElement $xml): static |
30
|
|
|
{ |
31
|
|
|
Assert::same($xml->localName, 'KeyInfo', InvalidDOMElementException::class); |
32
|
|
|
Assert::same($xml->namespaceURI, KeyInfo::NS, InvalidDOMElementException::class); |
33
|
|
|
|
34
|
|
|
$Id = self::getOptionalAttribute($xml, 'Id', null); |
35
|
|
|
|
36
|
|
|
$keyName = KeyName::getChildrenOfClass($xml); |
37
|
|
|
$keyValue = KeyValue::getChildrenOfClass($xml); |
38
|
|
|
$retrievalMethod = RetrievalMethod::getChildrenOfClass($xml); |
39
|
|
|
$x509Data = X509Data::getChildrenOfClass($xml); |
40
|
|
|
//$pgpData = PGPData::getChildrenOfClass($xml); |
41
|
|
|
//$spkiData = SPKIData::getChildrenOfClass($xml); |
42
|
|
|
//$mgmtData = MgmtData::getChildrenOfClass($xml); |
43
|
|
|
$other = self::getChildElementsFromXML($xml); |
44
|
|
|
|
45
|
|
|
$info = array_merge( |
46
|
|
|
$keyName, |
47
|
|
|
$keyValue, |
48
|
|
|
$retrievalMethod, |
49
|
|
|
$x509Data, |
50
|
|
|
//$pgpdata, |
51
|
|
|
//$spkidata, |
52
|
|
|
//$mgmtdata, |
53
|
|
|
$other, |
54
|
|
|
); |
55
|
|
|
|
56
|
|
|
return new static($info, $Id); |
57
|
|
|
} |
58
|
|
|
} |
59
|
|
|
|