|
1
|
|
|
<?php |
|
2
|
|
|
|
|
3
|
|
|
declare(strict_types=1); |
|
4
|
|
|
|
|
5
|
|
|
namespace SimpleSAML\Test\SAML2\XML\xenc11; |
|
6
|
|
|
|
|
7
|
|
|
use PHPUnit\Framework\Attributes\CoversClass; |
|
|
|
|
|
|
8
|
|
|
use PHPUnit\Framework\TestCase; |
|
9
|
|
|
use SimpleSAML\XML\Attribute as XMLAttribute; |
|
10
|
|
|
use SimpleSAML\XML\Chunk; |
|
11
|
|
|
use SimpleSAML\XML\DOMDocumentFactory; |
|
12
|
|
|
use SimpleSAML\XML\TestUtils\SchemaValidationTestTrait; |
|
13
|
|
|
use SimpleSAML\XML\TestUtils\SerializableElementTestTrait; |
|
14
|
|
|
use SimpleSAML\XMLSecurity\XML\xenc11\AbstractPBKDF2ParameterType; |
|
15
|
|
|
use SimpleSAML\XMLSecurity\XML\xenc11\AbstractXenc11Element; |
|
16
|
|
|
use SimpleSAML\XMLSecurity\XML\xenc11\IterationCount; |
|
17
|
|
|
use SimpleSAML\XMLSecurity\XML\xenc11\KeyLength; |
|
18
|
|
|
use SimpleSAML\XMLSecurity\XML\xenc11\OtherSource; |
|
19
|
|
|
use SimpleSAML\XMLSecurity\XML\xenc11\Parameters; |
|
20
|
|
|
use SimpleSAML\XMLSecurity\XML\xenc11\PBKDF2params; |
|
21
|
|
|
use SimpleSAML\XMLSecurity\XML\xenc11\PRF; |
|
22
|
|
|
use SimpleSAML\XMLSecurity\XML\xenc11\Salt; |
|
23
|
|
|
|
|
24
|
|
|
use function dirname; |
|
25
|
|
|
use function strval; |
|
26
|
|
|
|
|
27
|
|
|
/** |
|
28
|
|
|
* Class \SimpleSAML\XMLSecurity\XML\xenc11\PBKDF2paramsTest |
|
29
|
|
|
* |
|
30
|
|
|
* @package simplesamlphp/xml-security |
|
31
|
|
|
*/ |
|
32
|
|
|
#[CoversClass(PBKDF2params::class)] |
|
33
|
|
|
#[CoversClass(AbstractPBKDF2ParameterType::class)] |
|
34
|
|
|
#[CoversClass(AbstractXenc11Element::class)] |
|
35
|
|
|
final class PBKDF2paramsTest extends TestCase |
|
36
|
|
|
{ |
|
37
|
|
|
use SchemaValidationTestTrait; |
|
|
|
|
|
|
38
|
|
|
use SerializableElementTestTrait; |
|
|
|
|
|
|
39
|
|
|
|
|
40
|
|
|
/** |
|
41
|
|
|
*/ |
|
42
|
|
|
public static function setUpBeforeClass(): void |
|
43
|
|
|
{ |
|
44
|
|
|
self::$testedClass = PBKDF2params::class; |
|
45
|
|
|
|
|
46
|
|
|
self::$schemaFile = dirname(__FILE__, 4) . '/resources/schemas/xenc-schema-11.xsd'; |
|
47
|
|
|
|
|
48
|
|
|
self::$xmlRepresentation = DOMDocumentFactory::fromFile( |
|
49
|
|
|
dirname(__FILE__, 3) . '/resources/xml/xenc11_PBKDF2-params.xml', |
|
50
|
|
|
); |
|
51
|
|
|
} |
|
52
|
|
|
|
|
53
|
|
|
|
|
54
|
|
|
// marshalling |
|
55
|
|
|
|
|
56
|
|
|
|
|
57
|
|
|
/** |
|
58
|
|
|
*/ |
|
59
|
|
|
public function testMarshalling(): void |
|
60
|
|
|
{ |
|
61
|
|
|
$someDoc = DOMDocumentFactory::fromString( |
|
62
|
|
|
'<ssp:Chunk xmlns:ssp="urn:x-simplesamlphp:namespace">Some</ssp:Chunk>', |
|
63
|
|
|
); |
|
64
|
|
|
|
|
65
|
|
|
$parameters = new Parameters( |
|
66
|
|
|
[new Chunk($someDoc->documentElement)], |
|
67
|
|
|
[new XMLAttribute('urn:x-simplesamlphp:namespace', 'ssp', 'attr1', 'testval1')], |
|
68
|
|
|
); |
|
69
|
|
|
|
|
70
|
|
|
$otherSource = new OtherSource('urn:x-simplesamlphp:algorithm', $parameters); |
|
71
|
|
|
|
|
72
|
|
|
$salt = new Salt($otherSource); |
|
73
|
|
|
$iterationCount = new IterationCount(3); |
|
74
|
|
|
$keyLength = new KeyLength(4096); |
|
75
|
|
|
$prf = new PRF('urn:x-simplesamlphp:algorithm'); |
|
76
|
|
|
|
|
77
|
|
|
$PBKDF2params = new PBKDF2params($salt, $iterationCount, $keyLength, $prf); |
|
78
|
|
|
|
|
79
|
|
|
$this->assertEquals( |
|
80
|
|
|
self::$xmlRepresentation->saveXML(self::$xmlRepresentation->documentElement), |
|
81
|
|
|
strval($PBKDF2params), |
|
82
|
|
|
); |
|
83
|
|
|
} |
|
84
|
|
|
} |
|
85
|
|
|
|
The issue could also be caused by a filter entry in the build configuration. If the path has been excluded in your configuration, e.g.
excluded_paths: ["lib/*"], you can move it to the dependency path list as follows:For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths