You are here

public function XMLSecEnc::getCipherValue in SAML SP 2.0 Single Sign On (SSO) - SAML Service Provider 7

Retrieve the CipherValue text from this encrypted node.

Return value

string|null The Ciphervalue text, or null if no CipherValue is found.

Throws

Exception

1 call to XMLSecEnc::getCipherValue()
XMLSecEnc::decryptNode in includes/XMLSecurityKey.php
Decrypt this encrypted node.

File

includes/XMLSecurityKey.php, line 2023

Class

XMLSecEnc

Code

public function getCipherValue() {
  if (empty($this->rawNode)) {
    throw new Exception('Node to decrypt has not been set');
  }
  $doc = $this->rawNode->ownerDocument;
  $xPath = new DOMXPath($doc);
  $xPath
    ->registerNamespace('xmlencr', self::XMLENCNS);

  /* Only handles embedded content right now and not a reference */
  $query = "./xmlencr:CipherData/xmlencr:CipherValue";
  $nodeset = $xPath
    ->query($query, $this->rawNode);
  $node = $nodeset
    ->item(0);
  if (!$node) {
    return null;
  }
  return base64_decode($node->nodeValue);
}