You are here

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

Parameters

string $certs:

bool $isPEMFormat:

Return value

array

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

File

src/XMLSecurityKey.php, line 1593

Class

XMLSecurityDSig

Namespace

Drupal\miniorange_saml

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