|
13 | 13 | use SimpleSAML\XMLSecurity\Exception\NoSignatureFound; |
14 | 14 | use SimpleSAML\XMLSecurity\Exception\RuntimeException; |
15 | 15 | use SimpleSAML\XMLSecurity\Key\AbstractKey; |
| 16 | +use SimpleSAML\XMLSecurity\Key\X509Certificate; |
16 | 17 | use SimpleSAML\XMLSecurity\Utils\Security; |
17 | 18 | use SimpleSAML\XMLSecurity\Utils\XML; |
18 | 19 | use SimpleSAML\XMLSecurity\Utils\XPath; |
|
21 | 22 | use SimpleSAML\XMLSecurity\XML\ds\X509Certificate; |
22 | 23 | use SimpleSAML\XMLSecurity\XML\ds\X509Data; |
23 | 24 |
|
| 25 | +use function array_pop; |
| 26 | +use function base64_decode; |
| 27 | +use function in_array; |
| 28 | + |
24 | 29 | /** |
25 | 30 | * Helper trait for processing signed elements. |
26 | 31 | * |
@@ -132,14 +137,14 @@ private function validateReference(): SignedElementInterface |
132 | 137 | $this->validateReferenceUri($reference, $xml); |
133 | 138 |
|
134 | 139 | $xp = XPath::getXPath($xml->ownerDocument); |
135 | | - $sigNode = $xp->query('child::ds:Signature', $xml); |
| 140 | + $sigNode = XPath::xpQuery($xml, 'child::ds:Signature', $xp); |
136 | 141 | Assert::count( |
137 | 142 | $sigNode, |
138 | 143 | 1, |
139 | 144 | 'None or more than one signature found in object.', |
140 | 145 | RuntimeException::class |
141 | 146 | ); |
142 | | - $xml->removeChild($sigNode->item(0)); |
| 147 | + $xml->removeChild($sigNode[0]); |
143 | 148 |
|
144 | 149 | $data = XML::processTransforms($reference->getTransforms(), $xml); |
145 | 150 | $digest = Security::hash($reference->getDigestMethod()->getAlgorithm(), $data, false); |
@@ -266,11 +271,11 @@ public function verify(SignatureAlgorithm $verifier = null): SignedElementInterf |
266 | 271 | } |
267 | 272 |
|
268 | 273 | // build a valid PEM for the certificate |
269 | | - $cert = \SimpleSAML\XMLSecurity\Key\X509Certificate::PEM_HEADER . "\n" . |
| 274 | + $cert = X509Certificate::PEM_HEADER . "\n" . |
270 | 275 | $data->getRawContent() . "\n" . |
271 | | - \SimpleSAML\XMLSecurity\Key\X509Certificate::PEM_FOOTER; |
| 276 | + X509Certificate::PEM_FOOTER; |
272 | 277 |
|
273 | | - $key = new \SimpleSAML\XMLSecurity\Key\X509Certificate($cert); |
| 278 | + $key = new X509Certificate($cert); |
274 | 279 | $verifier = $factory->getAlgorithm($algId, $key); |
275 | 280 |
|
276 | 281 | try { |
|
0 commit comments