Skip to content

Commit 4073c66

Browse files
committed
No longer override c14n alg
Signed-off-by: Jaime Pérez <jaimepc@gmail.com>
1 parent 4137de0 commit 4073c66

1 file changed

Lines changed: 4 additions & 24 deletions

File tree

src/Utils/XML.php

Lines changed: 4 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,6 @@
66

77
use DOMElement;
88
use SimpleSAML\XMLSecurity\Constants as C;
9-
use SimpleSAML\XMLSecurity\XML\ds\Transform;
109
use SimpleSAML\XMLSecurity\XML\ds\Transforms;
1110

1211
use function count;
@@ -88,42 +87,23 @@ public static function canonicalizeData(
8887
*/
8988
public static function processTransforms(
9089
Transforms $transforms,
91-
DOMElement $data,
92-
bool $includeCommentNodes = false
90+
DOMElement $data
9391
): string {
9492
$canonicalMethod = C::C14N_EXCLUSIVE_WITHOUT_COMMENTS;
9593
$arXPath = null;
9694
$prefixList = null;
97-
foreach ($transforms as $transform) {
98-
/** @var Transform $transform */
99-
$algorithm = $transform->getAlgorithm();
100-
switch ($algorithm) {
95+
foreach ($transforms->getTransform() as $transform) {
96+
$canonicalMethod = $transform->getAlgorithm();
97+
switch ($canonicalMethod) {
10198
case C::C14N_EXCLUSIVE_WITHOUT_COMMENTS:
10299
case C::C14N_EXCLUSIVE_WITH_COMMENTS:
103-
if (!$includeCommentNodes) {
104-
// remove comment nodes by forcing it to use a canonicalization without comments
105-
$canonicalMethod = C::C14N_EXCLUSIVE_WITHOUT_COMMENTS;
106-
} else {
107-
$canonicalMethod = $algorithm;
108-
}
109-
110100
$inclusiveNamespaces = $transform->getInclusiveNamespaces();
111101
if ($inclusiveNamespaces !== null) {
112102
$prefixes = $inclusiveNamespaces->getPrefixes();
113103
if (count($prefixes) > 0) {
114104
$prefixList = $prefixes;
115105
}
116106
}
117-
break;
118-
case C::C14N_INCLUSIVE_WITHOUT_COMMENTS:
119-
case C::C14N_INCLUSIVE_WITH_COMMENTS:
120-
if (!$includeCommentNodes) {
121-
// remove comment nodes by forcing it to use a canonicalization without comments
122-
$canonicalMethod = C::C14N_INCLUSIVE_WITHOUT_COMMENTS;
123-
} else {
124-
$canonicalMethod = $algorithm;
125-
}
126-
127107
break;
128108
case C::XPATH_URI:
129109
$xpath = $transform->getXPath();

0 commit comments

Comments
 (0)