You are here

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

4 calls to Utilities::sanitize_certificate()
fix_attribute in ./miniorange_saml.module
IdentityProviders::parseSigningCertificate in includes/MetadataReader.php
miniorange_saml_save_idp_config in ./miniorange_saml_idp_setup.inc
Configure IdP.
Utilities::findCertificate in includes/Utilities.php

File

includes/Utilities.php, line 1337

Class

Utilities
This file is part of miniOrange SAML plugin.

Code

public static function sanitize_certificate($certificate) {
  if (!empty($certificate)) {
    $certificate = preg_replace("/[\r\n]+/", "", $certificate);
    $certificate = str_replace("-", "", $certificate);
    $certificate = str_replace("BEGIN CERTIFICATE", "", $certificate);
    $certificate = str_replace("END CERTIFICATE", "", $certificate);
    $certificate = str_replace(" ", "", $certificate);
    $certificate = chunk_split($certificate, 64, "\r\n");
    $certificate = "-----BEGIN CERTIFICATE-----\r\n" . $certificate . "-----END CERTIFICATE-----";
    return $certificate;
  }
}