public function SAML2_Assertion::encryptNameId in SAML SP 2.0 Single Sign On (SSO) - SAML Service Provider 8
Encrypt the NameID in the Assertion.
Parameters
XMLSecurityKey $key The encryption key.:
File
- src/
SAML2_Assertion.php, line 471
Class
Namespace
Drupal\miniorange_samlCode
public function encryptNameId(XMLSecurityKey $key) {
/* First create a XML representation of the NameID. */
$doc = new DOMDocument();
$root = $doc
->createElement('root');
$doc
->appendChild($root);
Utilities::addNameId($root, $this->nameId);
$nameId = $root->firstChild;
Utilities::getContainer()
->debugMessage($nameId, 'encrypt');
/* Encrypt the NameID. */
$enc = new XMLSecEnc();
$enc
->setNode($nameId);
// @codingStandardsIgnoreStart
$enc->type = XMLSecEnc::Element;
// @codingStandardsIgnoreEnd
$symmetricKey = new XMLSecurityKey(XMLSecurityKey::AES128_CBC);
$symmetricKey
->generateSessionKey();
$enc
->encryptKey($key, $symmetricKey);
$this->encryptedNameId = $enc
->encryptNode($symmetricKey);
$this->nameId = NULL;
}