|
1
|
|
|
<?php |
|
2
|
|
|
|
|
3
|
|
|
declare(strict_types=1); |
|
4
|
|
|
|
|
5
|
|
|
namespace SimpleSAML\SAML2\XML\saml; |
|
6
|
|
|
|
|
7
|
|
|
use SimpleSAML\SAML2\Utils; |
|
8
|
|
|
use SimpleSAML\XML\AbstractXMLElement; |
|
9
|
|
|
use SimpleSAML\XMLSecurity\Alg\Encryption\EncryptionAlgorithmInterface; |
|
10
|
|
|
use SimpleSAML\XMLSecurity\Utils\Security; |
|
11
|
|
|
use SimpleSAML\XMLSecurity\XML\EncryptedElementInterface; |
|
12
|
|
|
use SimpleSAML\XMLSecurity\XML\EncryptedElementTrait; |
|
13
|
|
|
use SimpleSAML\XMLSecurity\XMLSecurityKey; |
|
14
|
|
|
|
|
15
|
|
|
/** |
|
16
|
|
|
* Class handling encrypted assertions. |
|
17
|
|
|
* |
|
18
|
|
|
* @package simplesamlphp/saml2 |
|
19
|
|
|
*/ |
|
20
|
|
|
class EncryptedAssertion extends AbstractSamlElement implements EncryptedElementInterface |
|
21
|
|
|
{ |
|
22
|
|
|
use EncryptedElementTrait; |
|
|
|
|
|
|
23
|
|
|
|
|
24
|
|
|
/** @var bool */ |
|
25
|
|
|
protected bool $wasSignedAtConstruction = false; |
|
26
|
|
|
|
|
27
|
|
|
|
|
28
|
|
|
public function getBlacklistedAlgorithms(): ?array |
|
29
|
|
|
{ |
|
30
|
|
|
// return an array with the algorithms you don't want to allow to be used |
|
31
|
|
|
} |
|
32
|
|
|
|
|
33
|
|
|
|
|
34
|
|
|
public function getEncryptionBackend(): ?EncryptionBackend |
|
|
|
|
|
|
35
|
|
|
{ |
|
36
|
|
|
// return the encryption backend you want to use, |
|
37
|
|
|
// or null if you are fine with the default |
|
38
|
|
|
} |
|
39
|
|
|
|
|
40
|
|
|
|
|
41
|
|
|
/** |
|
42
|
|
|
* @inheritDoc |
|
43
|
|
|
* |
|
44
|
|
|
* @return \SimpleSAML\SAML2\XML\saml\Assertion |
|
45
|
|
|
* @throws \Exception |
|
46
|
|
|
*/ |
|
47
|
|
|
public function decrypt(EncryptionAlgorithmInterface $decryptor): Assertion |
|
48
|
|
|
{ |
|
49
|
|
|
// $assertionXML = Security::decryptElement($this->encryptedData->toXML(), $key, $blacklist); |
|
50
|
|
|
|
|
51
|
|
|
// Utils::getContainer()->debugMessage($assertionXML, 'decrypt'); |
|
52
|
|
|
|
|
53
|
|
|
// return Assertion::fromXML($assertionXML); |
|
54
|
|
|
} |
|
|
|
|
|
|
55
|
|
|
|
|
56
|
|
|
|
|
57
|
|
|
/** |
|
58
|
|
|
* @return bool |
|
59
|
|
|
*/ |
|
60
|
|
|
public function wasSignedAtConstruction(): bool |
|
61
|
|
|
{ |
|
62
|
|
|
return $this->wasSignedAtConstruction; |
|
63
|
|
|
} |
|
64
|
|
|
} |
|
65
|
|
|
|