| @@ 70-85 (lines=16) @@ | ||
| 67 | ||
| 68 | // reflects the simplesamlphp behaviour for BC, see |
|
| 69 | // https://github.com/simplesamlphp/simplesamlphp/blob/3d735912342767d391297cc5e13272a76730aca0/modules/saml/lib/Message.php#L369 |
|
| 70 | foreach ($decryptionKeys as $index => $key) { |
|
| 71 | try { |
|
| 72 | $decryptedAssertion = $assertion->getAssertion($key, $blacklistedKeys); |
|
| 73 | $this->logger->debug(sprintf('Decrypted Assertion with key "#%d"', $index)); |
|
| 74 | ||
| 75 | return $decryptedAssertion; |
|
| 76 | } catch (\Exception $e) { |
|
| 77 | $this->logger->debug(sprintf( |
|
| 78 | 'Could not decrypt assertion with key "#%d", "%s" thrown: "%s"', |
|
| 79 | $index, |
|
| 80 | get_class($e), |
|
| 81 | $e->getMessage() |
|
| 82 | )); |
|
| 83 | } |
|
| 84 | } |
|
| 85 | ||
| 86 | throw new NotDecryptedException(sprintf( |
|
| 87 | 'Could not decrypt the assertion, tried with "%d" keys. See the debug log for more information', |
|
| 88 | count($decryptionKeys) |
|
| @@ 58-70 (lines=13) @@ | ||
| 55 | $blacklistedKeys = $this->serviceProvider->getBlacklistedAlgorithms(); |
|
| 56 | } |
|
| 57 | ||
| 58 | foreach ($decryptionKeys as $index => $key) { |
|
| 59 | try { |
|
| 60 | $assertion->decryptNameId($key, $blacklistedKeys); |
|
| 61 | $this->logger->debug(sprintf('Decrypted assertion NameId with key "#%d"', $index)); |
|
| 62 | } catch (\Exception $e) { |
|
| 63 | $this->logger->debug(sprintf( |
|
| 64 | 'Decrypting assertion NameId with key "#%d" failed, "%s" thrown: "%s"', |
|
| 65 | $index, |
|
| 66 | get_class($e), |
|
| 67 | $e->getMessage() |
|
| 68 | )); |
|
| 69 | } |
|
| 70 | } |
|
| 71 | ||
| 72 | if ($assertion->isNameIdEncrypted()) { |
|
| 73 | throw new NotDecryptedException( |
|