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

Public Member Functions

 __construct (\DOMElement $xml=null)
 Constructor for SAML 2 encrypted assertions. More...
 
 setAssertion (Assertion $assertion, XMLSecurityKey $key)
 Set the assertion. More...
 
 getAssertion (XMLSecurityKey $inputKey, array $blacklist=array())
 Retrieve the assertion. More...
 
 toXML (\DOMNode $parentElement=null)
 Convert this encrypted assertion to an XML element. More...
 

Private Attributes

 $encryptedData
 

Detailed Description

Definition at line 13 of file EncryptedAssertion.php.

Constructor & Destructor Documentation

◆ __construct()

SAML2\EncryptedAssertion::__construct ( \DOMElement  $xml = null)

Constructor for SAML 2 encrypted assertions.

Parameters
\DOMElement | null$xmlThe encrypted assertion XML element.
Exceptions

Exception

Definition at line 28 of file EncryptedAssertion.php.

29 {
30 if ($xml === null) {
31 return;
32 }
33
34 $data = Utils::xpQuery($xml, './xenc:EncryptedData');
35 if (count($data) === 0) {
36 throw new \Exception('Missing encrypted data in <saml:EncryptedAssertion>.');
37 } elseif (count($data) > 1) {
38 throw new \Exception('More than one encrypted data element in <saml:EncryptedAssertion>.');
39 }
40 $this->encryptedData = $data[0];
41 }
static xpQuery(\DOMNode $node, $query)
Do an XPath query on an XML node.
Definition: Utils.php:191
$data
Definition: bench.php:6

References $data, and $xml.

Member Function Documentation

◆ getAssertion()

SAML2\EncryptedAssertion::getAssertion ( XMLSecurityKey  $inputKey,
array  $blacklist = array() 
)

Retrieve the assertion.

Parameters
XMLSecurityKey$inputKeyThe key we should use to decrypt the assertion.
array$blacklistBlacklisted decryption algorithms.
Returns
\SAML2\Assertion The decrypted assertion.

Definition at line 91 of file EncryptedAssertion.php.

92 {
93 $assertionXML = Utils::decryptElement($this->encryptedData, $inputKey, $blacklist);
94
95 Utils::getContainer()->debugMessage($assertionXML, 'decrypt');
96
97 return new Assertion($assertionXML);
98 }
static decryptElement(\DOMElement $encryptedData, XMLSecurityKey $inputKey, array $blacklist=array())
Decrypt an encrypted element.
Definition: Utils.php:558
static getContainer()
Definition: Utils.php:752

Referenced by SAML2\Assertion\Decrypter\decrypt().

+ Here is the caller graph for this function:

◆ setAssertion()

SAML2\EncryptedAssertion::setAssertion ( Assertion  $assertion,
XMLSecurityKey  $key 
)

Set the assertion.

Parameters
\SAML2\Assertion$assertionThe assertion.
XMLSecurityKey$keyThe key we should use to encrypt the assertion.
Exceptions

Exception

Definition at line 50 of file EncryptedAssertion.php.

51 {
52 $xml = $assertion->toXML();
53
54 Utils::getContainer()->debugMessage($xml, 'encrypt');
55
56 $enc = new XMLSecEnc();
57 $enc->setNode($xml);
58 $enc->type = XMLSecEnc::Element;
59
60 switch ($key->type) {
65 $symmetricKey = $key;
66 break;
67
70 $symmetricKey = new XMLSecurityKey(XMLSecurityKey::AES128_CBC);
71 $symmetricKey->generateSessionKey();
72
73 $enc->encryptKey($key, $symmetricKey);
74
75 break;
76
77 default:
78 throw new \Exception('Unknown key type for encryption: ' . $key->type);
79 }
80
81 $this->encryptedData = $enc->encryptNode($symmetricKey);
82 }
toXML(\DOMNode $parentElement=null)
Convert this assertion to an XML element.
Definition: Assertion.php:1362
$key
Definition: croninfo.php:18

References $key, $xml, and SAML2\Assertion\toXML().

+ Here is the call graph for this function:

◆ toXML()

SAML2\EncryptedAssertion::toXML ( \DOMNode  $parentElement = null)

Convert this encrypted assertion to an XML element.

Parameters
\DOMNode | null$parentElementThe DOM node the assertion should be created in.
Returns
\DOMElement This encrypted assertion.

Definition at line 106 of file EncryptedAssertion.php.

107 {
108 if ($parentElement === null) {
109 $document = DOMDocumentFactory::create();
110 $parentElement = $document;
111 } else {
112 $document = $parentElement->ownerDocument;
113 }
114
115 $root = $document->createElementNS(Constants::NS_SAML, 'saml:' . 'EncryptedAssertion');
116 $parentElement->appendChild($root);
117
118 $root->appendChild($document->importNode($this->encryptedData, true));
119
120 return $root;
121 }
const NS_SAML
The namespace for the SAML 2 assertions.
Definition: Constants.php:225
$root
Definition: sabredav.php:45

References $root.

Field Documentation

◆ $encryptedData

SAML2\EncryptedAssertion::$encryptedData
private

Definition at line 20 of file EncryptedAssertion.php.


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