You are here

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

Parameters

DOMDocument $objDoc:

int $pos:

Return value

DOMNode|null

File

src/XMLSecurityKey.php, line 852

Class

XMLSecurityDSig

Namespace

Drupal\miniorange_saml

Code

public function locateSignature($objDoc, $pos = 0) {
  if ($objDoc instanceof DOMDocument) {
    $doc = $objDoc;
  }
  else {
    $doc = $objDoc->ownerDocument;
  }
  if ($doc) {
    $xpath = new DOMXPath($doc);
    $xpath
      ->registerNamespace('secdsig', self::XMLDSIGNS);
    $query = ".//secdsig:Signature";
    $nodeset = $xpath
      ->query($query, $objDoc);
    $this->sigNode = $nodeset
      ->item($pos);
    $query = "./secdsig:SignedInfo";
    $nodeset = $xpath
      ->query($query, $this->sigNode);
    if ($nodeset->length > 1) {
      throw new Exception("Invalid structure - Too many SignedInfo elements found");
    }
    return $this->sigNode;
  }
  return null;
}