Skip to content

Commit

Permalink
add example convert .pfx to pem
Browse files Browse the repository at this point in the history
  • Loading branch information
giansalex committed Feb 14, 2018
1 parent 30f9cec commit f987854
Show file tree
Hide file tree
Showing 2 changed files with 40 additions and 3 deletions.
37 changes: 37 additions & 0 deletions Convert.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
## Convertir Pfx a otros formatos

## Convert to .PEM
El archivo resultante se utiliza para firmar los comprobantes electrónicos.
```php
use Greenter\XMLSecLibs\Tool\PfxConverter;

require __DIR__.'/../vendor/autoload.php';

$pfx = file_get_contents('your-cert.pfx');
$password = 'YOUR-PASSWORD';

$converter = new PfxConverter($pfx, $password);
$pem = $converter
->toPem()
->getResult();

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

### Convert a .CER
El archivo resultante se utiliza para subirlo a SUNAT.
```php
use Greenter\XMLSecLibs\Tool\PfxConverter;

require __DIR__.'/../vendor/autoload.php';

$pfx = file_get_contents('your-cert.pfx');
$password = 'YOUR-PASSWORD';

$converter = new PfxConverter($pfx, $password);
$pem = $converter
->toCer()
->getResult();

file_put_contents('certificate.cer', $pem);
```
6 changes: 3 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,10 @@
[![Travis-CI](https://travis-ci.org/giansalex/xmldsig.svg?branch=master)](https://travis-ci.org/giansalex/xmldsig)
[![Codacy Badge](https://api.codacy.com/project/badge/Grade/cb56bff3cd1545f2841614448bf31da2)](https://www.codacy.com/app/giansalex/xmldsig?utm_source=github.com&utm_medium=referral&utm_content=giansalex/xmldsig&utm_campaign=Badge_Grade)

Esta libreria se emplea para firmar documentos electronicos segun las normas de SUNAT.
Esta libreria se emplea para firmar comprobantes electrónicos según las normas de SUNAT.

Se requiere el certificado en .PEM, puede utilizar el siguiente ejemplo para [convertir el certificado .PFX al formato requerido](https://raw.githubusercontent.com/giansalex/xmldsig/master/Convert.md).

Se requiere convertir el certificado .PFX a .PEM, aqui una herramienta online para convertirlo:
https://www.sslshopper.com/ssl-converter.html

## Install:

Expand Down

0 comments on commit f987854

Please sign in to comment.