Skip to content

Commit 99c187a

Browse files
committed
Fix travis
1 parent c83a2f4 commit 99c187a

1 file changed

Lines changed: 13 additions & 12 deletions

File tree

tests/src/OneLogin/Saml2/UtilsTest.php

Lines changed: 13 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -855,18 +855,19 @@ public function testGenerateNameIdWithSPNameQualifier()
855855
$this->assertContains($nameidExpectedEnc, $nameIdEnc);
856856

857857
// Check AES128_GCM support
858-
859-
$nameidExpectedEnc = '<saml:EncryptedID><xenc:EncryptedData xmlns:xenc="http://www.w3.org/2001/04/xmlenc#" xmlns:dsig="http://www.w3.org/2000/09/xmldsig#" Type="http://www.w3.org/2001/04/xmlenc#Element"><xenc:EncryptionMethod Algorithm="http://www.w3.org/2009/xmlenc11#aes128-gcm"/><dsig:KeyInfo xmlns:dsig="http://www.w3.org/2000/09/xmldsig#"><xenc:EncryptedKey><xenc:EncryptionMethod Algorithm="http://www.w3.org/2001/04/xmlenc#rsa-oaep-mgf1p"/><xenc:CipherData><xenc:CipherValue>';
860-
861-
$nameIdEnc = Utils::generateNameId(
862-
$nameIdValue,
863-
$entityId,
864-
$nameIDFormat,
865-
$key,
866-
null,
867-
XMLSecurityKey::AES128_GCM
868-
);
869-
$this->assertContains($nameidExpectedEnc, $nameIdEnc);
858+
if (in_array("aes-128-gcm", openssl_get_cipher_methods())) {
859+
$nameidExpectedEnc = '<saml:EncryptedID><xenc:EncryptedData xmlns:xenc="http://www.w3.org/2001/04/xmlenc#" xmlns:dsig="http://www.w3.org/2000/09/xmldsig#" Type="http://www.w3.org/2001/04/xmlenc#Element"><xenc:EncryptionMethod Algorithm="http://www.w3.org/2009/xmlenc11#aes128-gcm"/><dsig:KeyInfo xmlns:dsig="http://www.w3.org/2000/09/xmldsig#"><xenc:EncryptedKey><xenc:EncryptionMethod Algorithm="http://www.w3.org/2001/04/xmlenc#rsa-oaep-mgf1p"/><xenc:CipherData><xenc:CipherValue>';
860+
861+
$nameIdEnc = Utils::generateNameId(
862+
$nameIdValue,
863+
$entityId,
864+
$nameIDFormat,
865+
$key,
866+
null,
867+
XMLSecurityKey::AES128_GCM
868+
);
869+
$this->assertContains($nameidExpectedEnc, $nameIdEnc);
870+
}
870871
}
871872

872873
/**

0 commit comments

Comments
 (0)