You are here

private function XMLSecurityKey::verifyOpenSSL in SAML SP 2.0 Single Sign On (SSO) - SAML Service Provider 7

Verifies the given data (string) belonging to the given signature using the openssl-extension

Returns: 1 on succesful signature verification, 0 when signature verification failed, -1 if an error occurred during processing.

NOTE: be very careful when checking the return value, because in PHP, -1 will be cast to True when in boolean context. So always check the return value in a strictly typed way, e.g. "$obj->verify(...) === 1".

Parameters

string $data:

string $signature:

Return value

int

1 call to XMLSecurityKey::verifyOpenSSL()
XMLSecurityKey::verifySignature in includes/XMLSecurityKey.php
Verifies the data (string) against the given signature using the extension assigned to the type in the constructor.

File

includes/XMLSecurityKey.php, line 526

Class

XMLSecurityKey

Code

private function verifyOpenSSL($data, $signature) {
  $algo = OPENSSL_ALGO_SHA1;
  if (!empty($this->cryptParams['digest'])) {
    $algo = $this->cryptParams['digest'];
  }
  return openssl_verify($data, $signature, $this->key, $algo);
}