-
Notifications
You must be signed in to change notification settings - Fork 14
Convert PFX to PEM or CER
Giancarlos Salas edited this page Feb 16, 2018
·
3 revisions
El archivo resultante se utiliza para firmar los comprobantes electrónicos.
use Greenter\XMLSecLibs\Certificate\X509Certificate;
use Greenter\XMLSecLibs\Certificate\X509ContentType;
require 'vendor/autoload.php';
$pfx = file_get_contents('your-cert.pfx');
$password = 'YOUR-PASSWORD';
$certificate = new X509Certificate($pfx, $password);
$pem = $certificate->export(X509ContentType::PEM);
file_put_contents('certificate.pem', $pem);
El archivo resultante se utiliza para subirlo a SUNAT.
use Greenter\XMLSecLibs\Certificate\X509Certificate;
use Greenter\XMLSecLibs\Certificate\X509ContentType;
require 'vendor/autoload.php';
$pfx = file_get_contents('your-cert.pfx');
$password = 'YOUR-PASSWORD';
$certificate = new X509Certificate($pfx, $password);
$cer = $certificate->export(X509ContentType::CER);
file_put_contents('certificate.cer', $cer);