You are here

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

Get the raw thumbprint of a certificate

Parameters

string $cert:

Return value

null|string

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

File

src/XMLSecurityKey.php, line 287

Class

XMLSecurityKey

Namespace

Drupal\miniorange_saml

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