XMLSecurityDSig::verify PHP Method

verify() public method

public verify ( $objKey )
    public function verify($objKey)
    {
        $doc = $this->sigNode->ownerDocument;
        $xpath = new DOMXPath($doc);
        $xpath->registerNamespace('secdsig', XMLSecurityDSig::XMLDSIGNS);
        $query = "string(./secdsig:SignatureValue)";
        $sigValue = $xpath->evaluate($query, $this->sigNode);
        if (empty($sigValue)) {
            throw new Exception("Unable to locate SignatureValue");
        }
        return $objKey->verifySignature($this->signedInfo, base64_decode($sigValue));
    }

Usage Example

 /**
  * @param \XMLSecurityKey $key
  * @return bool
  * @throws \AerialShip\LightSaml\Error\SecurityException
  */
 public function validate(\XMLSecurityKey $key)
 {
     if ($this->signature == null) {
         return false;
     }
     if ($key->type != \XMLSecurityKey::RSA_SHA1) {
         throw new SecurityException('Key type must be RSA_SHA1 but got ' . $key->type);
     }
     $key = $this->castKeyIfNecessary($key);
     $ok = $this->signature->verify($key);
     if (!$ok) {
         throw new SecurityException('Unable to verify Signature');
     }
     return true;
 }
All Usage Examples Of XMLSecurityDSig::verify