Jose\KeyConverter\KeyConverter::sanitizePEM PHP Method

sanitizePEM() private static method

This method modify the PEM to get 64 char lines and fix bug with old OpenSSL versions.
private static sanitizePEM ( string &$pem )
$pem string
    private static function sanitizePEM(&$pem)
    {
        preg_match_all('#(-.*-)#', $pem, $matches, PREG_PATTERN_ORDER);
        $ciphertext = preg_replace('#-.*-|\\r|\\n| #', '', $pem);
        $pem = $matches[0][0] . PHP_EOL;
        $pem .= chunk_split($ciphertext, 64, PHP_EOL);
        $pem .= $matches[0][1] . PHP_EOL;
    }