<?php

require 'vendor/autoload.php';

use Greenter\XMLSecLibs\Certificate\X509Certificate;
use Greenter\XMLSecLibs\Certificate\X509ContentType;

$pfx = file_get_contents(__DIR__ . '/webroot/certificados/certificadovida.pfx');
//contraseña del certificado, se obtiene del portal de SUNAT al descargar el certificado
$password = 'QPdan98user';

$certificate = new X509Certificate($pfx, $password);

$pem = $certificate->export(X509ContentType::PEM);

file_put_contents(
    __DIR__ . '/webroot/certificados/certificadovida.pem',
    $pem
);

echo "CERTIFICADO PEM GENERADO";