You are here

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

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 src/XMLSecurityKey.php
Verifies the data (string) against the given signature using the extension assigned to the type in the constructor.

File

src/XMLSecurityKey.php, line 493

Class

XMLSecurityKey

Namespace

Drupal\miniorange_saml

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