src/KeyConverter/KeyConverter.php
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;
    }
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;
    }
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 ; }
This method modify the PEM to get 64 char lines and fix bug with old OpenSSL versions.

@param string $pem
This method modify the PEM to get 64 char lines and fix bug with old OpenSSL versions .