Skip to content

Commit

Permalink
Add support for encrypted name id in encrypted assertion. See #594
Browse files Browse the repository at this point in the history
  • Loading branch information
pitbulk committed Sep 29, 2024
1 parent 2df155b commit 78bc99c
Show file tree
Hide file tree
Showing 3 changed files with 81 additions and 21 deletions.
93 changes: 72 additions & 21 deletions lib/Saml2/Response.php
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,13 @@ class OneLogin_Saml2_Response
*/
public $encrypted = false;

/**
* The response contains an encrypted nameId in the assertion.
*
* @var bool
*/
public $encryptedNameId = false;

/**
* After validation, if it fail this var has the cause of the problem
* @var string
Expand Down Expand Up @@ -200,14 +207,12 @@ public function isValid($requestId = null)
);
}

if ($security['wantNameIdEncrypted']) {
$encryptedIdNodes = $this->_queryAssertion('/saml:Subject/saml:EncryptedID/xenc:EncryptedData');
if ($encryptedIdNodes->length != 1) {
throw new OneLogin_Saml2_ValidationError(
"The NameID of the Response is not encrypted and the SP requires it",
OneLogin_Saml2_ValidationError::NO_ENCRYPTED_NAMEID
);
}
$this->encryptedNameId = $this->encryptedNameId || $this->_queryAssertion('/saml:Subject/saml:EncryptedID/xenc:EncryptedData')->length > 0;
if (!$this->encryptedNameId && $security['wantNameIdEncrypted']) {
throw new OneLogin_Saml2_ValidationError(
"The NameID of the Response is not encrypted and the SP requires it",
OneLogin_Saml2_ValidationError::NO_ENCRYPTED_NAMEID
);
}

// Validate Conditions element exists
Expand Down Expand Up @@ -366,17 +371,6 @@ public function isValid($requestId = null)
}
}

// Detect case not supported
if ($this->encrypted) {
$encryptedIDNodes = OneLogin_Saml2_Utils::query($this->decryptedDocument, '/samlp:Response/saml:Assertion/saml:Subject/saml:EncryptedID');
if ($encryptedIDNodes->length > 0) {
throw new OneLogin_Saml2_ValidationError(
'SAML Response that contains a an encrypted Assertion with encrypted nameId is not supported.',
OneLogin_Saml2_ValidationError::NOT_SUPPORTED
);
}
}

if (empty($signedElements) || (!$hasSignedResponse && !$hasSignedAssertion)) {
throw new OneLogin_Saml2_ValidationError(
'No Signature found. SAML Response rejected',
Expand Down Expand Up @@ -585,9 +579,15 @@ public function getNameIdData()
if ($encryptedIdDataEntries->length == 1) {
$encryptedData = $encryptedIdDataEntries->item(0);

$key = $this->_settings->getSPkey();
$pem = $this->_settings->getSPkey();
if (empty($pem)) {
throw new OneLogin_Saml2_Error(
"No private key available, check settings",
OneLogin_Saml2_Error::PRIVATE_KEY_NOT_FOUND
);
}
$seckey = new XMLSecurityKey(XMLSecurityKey::RSA_1_5, array('type'=>'private'));
$seckey->loadKey($key);
$seckey->loadKey($pem);

$nameId = OneLogin_Saml2_Utils::decryptElement($encryptedData, $seckey);

Expand Down Expand Up @@ -1139,6 +1139,17 @@ protected function _decryptAssertion($dom)
if ($check === false) {
throw new Exception('Error: string from decrypted assertion could not be loaded into a XML document');
}

// check if the decrypted assertion contains an encryptedID
$encryptedID = $decrypted->getElementsByTagName('EncryptedID')->item(0);
if ($encryptedID) {
// decrypt the encryptedID
$this->encryptedNameId = true;
$encryptedData = $encryptedID->getElementsByTagName('EncryptedData')->item(0);
$nameId = $this->decryptNameId($encryptedData, $pem);
OneLogin_Saml2_Utils::treeCopyReplace($encryptedID, $nameId);
}

if ($encData->parentNode instanceof DOMDocument) {
return $decrypted;
} else {
Expand Down Expand Up @@ -1171,6 +1182,46 @@ protected function _decryptAssertion($dom)
}
}

/**
* Decrypt EncryptedID element
*
* @param \DOMElement $encryptedData The encrypted data.
* @param string $key The private key
*
* @return \DOMElement The decrypted element.
*
* @throws OneLogin_Saml2_Error
* @throws OneLogin_Saml2_ValidationError
*/
private function decryptNameId(\DOMElement $encryptedData, string $pem)
{
$objenc = new XMLSecEnc();
$encData = $objenc->locateEncryptedData($encryptedData);
$objenc->setNode($encData);
$objenc->type = $encData->getAttribute("Type");
if (!$objKey = $objenc->locateKey()) {
throw new OneLogin_Saml2_ValidationError(
"Unknown algorithm",
ValidationError::KEY_ALGORITHM_ERROR
);
}
$key = null;
if ($objKeyInfo = $objenc->locateKeyInfo($objKey)) {
if ($objKeyInfo->isEncrypted) {
$objencKey = $objKeyInfo->encryptedCtx;
$objKeyInfo->loadKey($pem, false, false);
$key = $objencKey->decryptKey($objKeyInfo);
} else {
// symmetric encryption key support
$objKeyInfo->loadKey($pem, false, false);
}
}
if (empty($objKey->key)) {
$objKey->loadKey($key);
}
return OneLogin_Saml2_Utils::decryptElement($encryptedData, $objKey);
}

/**
* After execute a validation process, if fails this method returns the cause
*
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
PD94bWwgdmVyc2lvbj0iMS4wIj8+DQo8c2FtbHA6UmVzcG9uc2UgeG1sbnM6c2FtbHA9InVybjpvYXNpczpuYW1lczp0YzpTQU1MOjIuMDpwcm90b2NvbCIgeG1sbnM6c2FtbD0idXJuOm9hc2lzOm5hbWVzOnRjOlNBTUw6Mi4wOmFzc2VydGlvbiIgSUQ9InBmeDczMzI1MzJjLWQ2MDUtZmVkOS0xNTk2LWVlYTM0YjkyNDY2NiIgVmVyc2lvbj0iMi4wIiBJc3N1ZUluc3RhbnQ9IjIwMTQtMDItMTlUMDE6Mzc6MDFaIiBEZXN0aW5hdGlvbj0iaHR0cHM6Ly9waXRidWxrLm5vLWlwLm9yZy9uZXdvbmVsb2dpbi9kZW1vMS9pbmRleC5waHA/YWNzIiBJblJlc3BvbnNlVG89Ik9ORUxPR0lOXzVmZTlkNmU0OTliMmYwOTEzMjA2YWFiM2Y3MTkxNzI5MDQ5YmI4MDciPjxzYW1sOklzc3Vlcj5odHRwOi8vaWRwLmV4YW1wbGUuY29tLzwvc2FtbDpJc3N1ZXI+PGRzOlNpZ25hdHVyZSB4bWxuczpkcz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC8wOS94bWxkc2lnIyI+DQogIDxkczpTaWduZWRJbmZvPjxkczpDYW5vbmljYWxpemF0aW9uTWV0aG9kIEFsZ29yaXRobT0iaHR0cDovL3d3dy53My5vcmcvMjAwMS8xMC94bWwtZXhjLWMxNG4jIi8+DQogICAgPGRzOlNpZ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3hzMmkweld6RWpLWkdPaFREU1pjdWNnZWJuUi8xR0JlRy84RXVEYksxcWppSGhoaGErNVV3QmNwaW9JMFhORXJiTUVOSnZVdEpYcEtmd3FiUXg5MnZuUDJVY1plSUJ5WWE0YS9OUVEySWYrYXlGTFZpdEJiL1FNOGF4dUJyODBUbnIzZzUxVjYwQWRBUUZ3T1Q0K3Zkc0V5UnlzenN5bGgrckhlaEp1RHdncWJIMVBIODIyOVVaWWFqYjBpbEhSZUlKV1gxY0NFaTBzTVhEdTJJT2hCbXpOMzBhRFZSUkdNNHZKdU1ueEhYak1FQ2pvTjhkQUNQSnN2aTdNc0JqMHRkNjdKRDVxRVJjUkZBdk14QkF2Z1VmUmxXQUFtNXdzTUFmSGx0OFV6bkcyTGxXWEczQjcxYkoyUWhrbUpZendiemVjYzRiQ1dPQzBTalhIL3QvSTU5SHd0WlBFVHpITE9XOVpBMk1ZalVYRHpGc2xFbW5sdm9RT0EvcVlMT2dVY05ZVStDWDE0T3BCbjMzSHZEczZTeVBpb0VLdEJlTHp5Q21EWGgrdHlKWTUwZ1ppVVA2d3ovL04wdDBtM1JTTWtFcWVCYU1taWxGZjhIakdja1RXT2RQd1hqUjQvWmU0RUJ2ZG9aTzF0QjQvNHA0SSt2aTFzWTR3Y1JVZFlvbW54bWVaaG9RdnF0UFZmTTdtM1ZVaVM2Yktqd1Jpd2Y4PC94ZW5jOkNpcGhlclZhbHVlPg0KICAgPC94ZW5jOkNpcGhlckRhdGE+DQo8L3hlbmM6RW5jcnlwdGVkRGF0YT48L3NhbWw6RW5jcnlwdGVkQXNzZXJ0aW9uPjwvc2FtbHA6UmVzcG9uc2U+
8 changes: 8 additions & 0 deletions tests/src/OneLogin/Saml2/ResponseTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -1813,4 +1813,12 @@ public function testIsValidSignUsingX509certMulti()
$response = new OneLogin_Saml2_Response($settings, $xml);
$this->assertTrue($response->isValid());
}

public function testCanGetEncryptedNameIdInEncryptedAssertion()
{
$xml = file_get_contents(TEST_ROOT . '/data/responses/response_encrypted_nameid_encrypted_assertion2.xml.base64');
$response = new OneLogin_Saml2_Response($this->_settings, $xml);
$this->assertTrue($response->isValid());
$this->assertEquals('492882615acf31c8096b627245d76ae53036c090', $response->getNameId());
}
}

0 comments on commit 78bc99c

Please sign in to comment.