thegreenter / xmldsig

Firma digital en Facturación Electrónica
BSD 3-Clause "New" or "Revised" License
37 stars 14 forks source link

Error exportando pfx a pem #3

Closed abelnexus closed 6 years ago

abelnexus commented 6 years ago

amigo no encuentro la falla me aparece este error: Fatal error: Uncaught Exception: error:0D07803A:asn1 encoding routines:asn1_item_embed_d2i:nested asn1 error in C:\xampp\htdocs\xmldsig-master\src\Certificate\X509Certificate.php:184 Stack trace: #0 C:\xampp\htdocs\xmldsig-master\src\Certificate\X509Certificate.php(42): Greenter\XMLSecLibs\Certificate\X509Certificate->parsePfx('-----BEGIN CERT...', 'EQ4qpJKSWGmnbFd...') #1 C:\xampp\htdocs\xmldsig-master\index.php(10): Greenter\XMLSecLibs\Certificate\X509Certificate->__construct('-----BEGIN CERT...', 'EQ4qpJKSWGmnbFd...') #2 {main} thrown in C:\xampp\htdocs\xmldsig-master\src\Certificate\X509Certificate.php on line 184

abelnexus commented 6 years ago

asad

abelnexus commented 6 years ago

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

require 'vendor/autoload.php';

$pfx = file_get_contents('certi.pfx'); $password = 'EQ4qpJKSWGmnbFdq';

$certificate = new X509Certificate($pfx, $password); $pem = $certificate->export(X509ContentType::PEM);

file_put_contents('certificate.pem', $pem);

giansalex commented 6 years ago

tienes los archivos.p12 y .cer?

abelnexus commented 6 years ago

si

abelnexus commented 6 years ago

mmmm no se que paso pero ahora si me genero el archivo .pem

giansalex commented 6 years ago

que bueno.

DennisDllg commented 5 years ago

Hola, tengo el mismo problema que abelnexus, no se como utilizar estos 2 certificados, donde deben estar? como invocarlo?: use Greenter\XMLSecLibs\Certificate\X509Certificate; use Greenter\XMLSecLibs\Certificate\X509ContentType; alguien podria ayudarme.