diff --git a/composer.json b/composer.json index 5c4975a83..77438a31a 100644 --- a/composer.json +++ b/composer.json @@ -15,7 +15,7 @@ "ext-zlib": "*", "psr/log": "^2.0 || ^3.0", - "robrichards/xmlseclibs": "^3.1.5", + "robrichards/xmlseclibs": "^4.0.0", "simplesamlphp/xml-common": "^2.7", "webmozart/assert": "^2.0" }, diff --git a/src/SAML2/Utils.php b/src/SAML2/Utils.php index 7958b9301..8c9e0ad25 100644 --- a/src/SAML2/Utils.php +++ b/src/SAML2/Utils.php @@ -176,7 +176,7 @@ public static function castKey(XMLSecurityKey $key, string $algorithm, ?string $ throw new Exception('Unsupported signing algorithm.'); } - $keyInfo = openssl_pkey_get_details($key->key); + $keyInfo = openssl_pkey_get_details(openssl_pkey_get_public($key->key)); if ($keyInfo === false) { throw new Exception('Unable to get key details from XMLSecurityKey.'); } @@ -420,6 +420,9 @@ private static function doDecryptElement( throw new Exception('Could not locate key algorithm in encrypted data.'); } + // Enable support for RSA 1.5 in the library. If it's blacklisted, we will throw an exception below.0 + $enc->allowRSA15KeyTransport = true; + $symmetricKeyInfo = $enc->locateKeyInfo($symmetricKey); if (!$symmetricKeyInfo) { throw new Exception('Could not locate for the encrypted key.'); diff --git a/tests/SAML2/Response/XmlSignatureWrappingTest.php b/tests/SAML2/Response/XmlSignatureWrappingTest.php index 64fd66743..e1809a0d2 100644 --- a/tests/SAML2/Response/XmlSignatureWrappingTest.php +++ b/tests/SAML2/Response/XmlSignatureWrappingTest.php @@ -62,7 +62,7 @@ public function testThatASignatureReferencingAnEmbeddedAssertionIsNotValid(): vo public function testThatASignatureReferencingAnotherAssertionIsNotValid(): void { $this->expectException(Exception::class); - $this->expectExceptionMessage('Reference validation failed'); + $this->expectExceptionMessage('Reference URI does not identify a node'); $assertion = $this->getSignedAssertionWithSignatureThatReferencesAnotherAssertion(); $this->signatureValidator->hasValidSignature($assertion, $this->identityProviderConfiguration);