You are here

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

Parameters

string $certs:

bool $isPEMFormat:

Return value

array

2 calls to XMLSecurityDSig::staticGet509XCerts()
XMLSecurityDSig::get509XCert in includes/XMLSecurityKey.php
XMLSecurityDSig::staticAdd509Cert in includes/XMLSecurityKey.php

File

includes/XMLSecurityKey.php, line 1625

Class

XMLSecurityDSig

Code

public static function staticGet509XCerts($certs, $isPEMFormat = true) {
  if ($isPEMFormat) {
    $data = '';
    $certlist = array();
    $arCert = explode("\n", $certs);
    $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) {
          $inData = false;
          $certlist[] = $data;
          $data = '';
          continue;
        }
        $data .= trim($curData);
      }
    }
    return $certlist;
  }
  else {
    return array(
      $certs,
    );
  }
}