You are here

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

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 src/XMLSecurityKey.php
Decrypt this encrypted node.

File

src/XMLSecurityKey.php, line 1991

Class

XMLSecEnc

Namespace

Drupal\miniorange_saml

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);
}