ILIAS  release_5-3 Revision v5.3.23-19-g915713cf615
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

Definition at line 28 of file EncryptedAssertion.php.

References $data, and $xml.

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  }
$xml
Definition: metadata.php:240
static xpQuery(\DOMNode $node, $query)
Do an XPath query on an XML node.
Definition: Utils.php:191

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
The decrypted assertion.

Definition at line 91 of file EncryptedAssertion.php.

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

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
+ 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

Definition at line 50 of file EncryptedAssertion.php.

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

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  }
$xml
Definition: metadata.php:240
$key
Definition: croninfo.php:18
static getContainer()
Definition: Utils.php:752
+ 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
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:220

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: