You are here

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

Parameters

$refNode:

string $data:

Return value

bool

1 call to XMLSecurityDSig::validateDigest()
XMLSecurityDSig::processRefNode in includes/XMLSecurityKey.php

File

includes/XMLSecurityKey.php, line 1070

Class

XMLSecurityDSig

Code

public function validateDigest($refNode, $data) {
  $xpath = new DOMXPath($refNode->ownerDocument);
  $xpath
    ->registerNamespace('secdsig', self::XMLDSIGNS);
  $query = 'string(./secdsig:DigestMethod/@Algorithm)';
  $digestAlgorithm = $xpath
    ->evaluate($query, $refNode);
  $digValue = $this
    ->calculateDigest($digestAlgorithm, $data, false);
  $query = 'string(./secdsig:DigestValue)';
  $digestValue = $xpath
    ->evaluate($query, $refNode);
  return $digValue === base64_decode($digestValue);
}