|
6 | 6 |
|
7 | 7 | use DOMElement; |
8 | 8 | use SimpleSAML\XMLSecurity\Constants as C; |
9 | | -use SimpleSAML\XMLSecurity\XML\ds\Transform; |
10 | 9 | use SimpleSAML\XMLSecurity\XML\ds\Transforms; |
11 | 10 |
|
12 | 11 | use function count; |
@@ -88,42 +87,23 @@ public static function canonicalizeData( |
88 | 87 | */ |
89 | 88 | public static function processTransforms( |
90 | 89 | Transforms $transforms, |
91 | | - DOMElement $data, |
92 | | - bool $includeCommentNodes = false |
| 90 | + DOMElement $data |
93 | 91 | ): string { |
94 | 92 | $canonicalMethod = C::C14N_EXCLUSIVE_WITHOUT_COMMENTS; |
95 | 93 | $arXPath = null; |
96 | 94 | $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) { |
101 | 98 | case C::C14N_EXCLUSIVE_WITHOUT_COMMENTS: |
102 | 99 | 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 | | - |
110 | 100 | $inclusiveNamespaces = $transform->getInclusiveNamespaces(); |
111 | 101 | if ($inclusiveNamespaces !== null) { |
112 | 102 | $prefixes = $inclusiveNamespaces->getPrefixes(); |
113 | 103 | if (count($prefixes) > 0) { |
114 | 104 | $prefixList = $prefixes; |
115 | 105 | } |
116 | 106 | } |
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 | | - |
127 | 107 | break; |
128 | 108 | case C::XPATH_URI: |
129 | 109 | $xpath = $transform->getXPath(); |
|
0 commit comments