You are here

public static function XMLSecurityKey::getRawThumbprint in SAML SP 2.0 Single Sign On (SSO) - SAML Service Provider 7

Get the raw thumbprint of a certificate

Parameters

string $cert:

Return value

null|string

2 calls to XMLSecurityKey::getRawThumbprint()
MiniOrangeAcs::processSamlResponse in includes/Acs.php
The function processSamlResponse.
XMLSecurityKey::loadKey in includes/XMLSecurityKey.php
Loads the given key, or - with isFile set true - the key from the keyfile.

File

includes/XMLSecurityKey.php, line 320

Class

XMLSecurityKey

Code

public static function getRawThumbprint($cert) {
  $arCert = explode("\n", $cert);
  $data = '';
  $inData = false;
  foreach ($arCert as $curData) {
    if (!$inData) {
      if (strncmp($curData, '-----BEGIN CERTIFICATE', 22) == 0) {
        $inData = true;
      }
    }
    else {
      if (strncmp($curData, '-----END CERTIFICATE', 20) == 0) {
        break;
      }
      $data .= trim($curData);
    }
  }
  if (!empty($data)) {
    return strtolower(sha1(base64_decode($data)));
  }
  return null;
}