You are here

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

Parameters

$refNode:

string $data:

Return value

bool

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

File

src/XMLSecurityKey.php, line 1037

Class

XMLSecurityDSig

Namespace

Drupal\miniorange_saml

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