Ejemplo n.º 1
0
 public function decryptAttributes($key, array $blacklist = array())
 {
     if ($this->encryptedAttribute === null) {
         return;
     }
     $attributes = $this->encryptedAttribute;
     foreach ($attributes as $attributeEnc) {
         /*Decrypt node <EncryptedAttribute>*/
         $attribute = SAML2_Utils::decryptElement($attributeEnc->getElementsByTagName('EncryptedData')->item(0), $key, $blacklist);
         if (!$attribute->hasAttribute('Name')) {
             throw new Exception('Missing name on <saml:Attribute> element.');
         }
         $name = $attribute->getAttribute('Name');
         if ($attribute->hasAttribute('NameFormat')) {
             $nameFormat = $attribute->getAttribute('NameFormat');
         } else {
             $nameFormat = SAML2_Const::NAMEFORMAT_UNSPECIFIED;
         }
         if ($firstAttribute) {
             $this->nameFormat = $nameFormat;
             $firstAttribute = FALSE;
         } else {
             if ($this->nameFormat !== $nameFormat) {
                 $this->nameFormat = SAML2_Const::NAMEFORMAT_UNSPECIFIED;
             }
         }
         if (!array_key_exists($name, $this->attributes)) {
             $this->attributes[$name] = array();
         }
         $values = SAML2_Utils::xpQuery($attribute, './saml_assertion:AttributeValue');
         foreach ($values as $value) {
             $this->attributes[$name][] = trim($value->textContent);
         }
     }
 }
Ejemplo n.º 2
0
 /**
  * Retrieve the assertion.
  *
  * @param  XMLSecurityKey  $inputKey  The key we should use to decrypt the assertion.
  * @param  array           $blacklist Blacklisted decryption algorithms.
  * @return SAML2_Assertion The decrypted assertion.
  */
 public function getAssertion(XMLSecurityKey $inputKey, array $blacklist = array())
 {
     $assertionXML = SAML2_Utils::decryptElement($this->encryptedData, $inputKey, $blacklist);
     SAML2_Utils::getContainer()->debugMessage($assertionXML, 'decrypt');
     return new SAML2_Assertion($assertionXML);
 }
Ejemplo n.º 3
0
 /**
  * Retrieve the assertion.
  *
  * @param XMLSecurityKey $key  The key we should use to decrypt the assertion.
  * @return SAML2_Assertion  The decrypted assertion.
  */
 public function getAssertion(XMLSecurityKey $inputKey)
 {
     $assertionXML = SAML2_Utils::decryptElement($this->encryptedData, $inputKey);
     return new SAML2_Assertion($assertionXML);
 }
Ejemplo n.º 4
0
 /**
  * Decrypt the NameID in the LogoutRequest.
  *
  * @param XMLSecurityKey $key       The decryption key.
  * @param array          $blacklist Blacklisted decryption algorithms.
  */
 public function decryptNameId(XMLSecurityKey $key, array $blacklist = array())
 {
     if ($this->encryptedNameId === NULL) {
         /* No NameID to decrypt. */
         return;
     }
     $nameId = SAML2_Utils::decryptElement($this->encryptedNameId, $key, $blacklist);
     SAML2_Utils::getContainer()->debugMessage($nameId, 'decrypt');
     $this->nameId = SAML2_Utils::parseNameId($nameId);
     $this->encryptedNameId = NULL;
 }
Ejemplo n.º 5
0
 /**
  * Decrypt the NameID in the LogoutRequest.
  *
  * @param XMLSecurityKey $key  The decryption key.
  */
 public function decryptNameId(XMLSecurityKey $key)
 {
     if ($this->encryptedNameId === NULL) {
         /* No NameID to decrypt. */
         return;
     }
     $nameId = SAML2_Utils::decryptElement($this->encryptedNameId, $key);
     $this->nameId = SAML2_Utils::parseNameId($nameId);
     $this->encryptedNameId = NULL;
 }
Ejemplo n.º 6
0
 /**
  * Retrieve the assertion.
  *
  * @param XMLSecurityKey $key  The key we should use to decrypt the assertion.
  * @return SAML2_Assertion  The decrypted assertion.
  */
 public function getAssertion(XMLSecurityKey $inputKey)
 {
     $assertionXML = SAML2_Utils::decryptElement($this->encryptedData, $inputKey);
     SimpleSAML_Utilities::debugMessage($assertionXML, 'decrypt');
     return new SAML2_Assertion($assertionXML);
 }