Code Monkey home page Code Monkey logo

xmldsig's People

Contributors

giansalex avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar

xmldsig's Issues

error

Buenas noches. Por favor me podria ayudar con este error. gracias.

Warning: require(vendor/autoload.php): failed to open stream: No such file or directory in C:\xampp\htdocs\vendor\greenter\xmldsig\src\Sunat\firm5.php on line 5

Fatal error: require(): Failed opening required 'vendor/autoload.php' (include_path='C:\xampp\php\PEAR') in C:\xampp\htdocs\vendor\greenter\xmldsig\src\Sunat\firm5.php on line 5

error:23076071:PKCS12 verify failure

namespace App\Controllers\Sunat;

use Psr\Http\Message\ServerRequestInterface as Request;
use Psr\Http\Message\ResponseInterface as Response;

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

use App\Controllers\NsAppController;

class NsCertificadoController extends NsAppController
{
	public function pem(Request $request,Response $response){

		$pfx = file_get_contents(_APP_CDN_PATH.'/NUEVOeG9yVURJN3NOU3ZjQktQZQ==.pfx');
		$password = 'pA2kG9VVYn4M7GNE';

		$certificate = new X509Certificate($pfx,$password);
		$pem = $certificate->export(X509ContentType::PEM);
		
		file_put_contents(_APP_CDN_PATH.'/certificate.pem', $pem);
		return _APP_WSCDN.'/certificate.pem';
	}

	public function cer(Request $request,Response $response){

		$pfx = file_get_contents(_APP_CDN_PATH.'/NUEVOeG9yVURJN3NOU3ZjQktQZQ==.pfx');
		$password = 'pA2kG9VVYn4M7GNE';

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

		file_put_contents(_APP_CDN_PATH.'/certificate.cer', $cer);
		return _APP_WSCDN.'/certificate.cer';
	}

}

Me devuelve esto alguna idea???

Type: Exception
Message: error:23076071:PKCS12 routines:PKCS12_parse:mac verify failure
File: /AppServer/vendor/greenter/xmldsig/src/Certificate/X509Certificate.php
Line: 184
Trace: #0 /AppServer/vendor/greenter/xmldsig/src/Certificate/X509Certificate.php(42): Greenter\XMLSecLibs\Certificate\X509Certificate->parsePfx('0\x82,\x05\x02\x01\x030\x82+\xCB\x06\t*\x86...', 'pB2kG9VVYn4M7GN...')
#1 /AppServer/app/app/Controllers/Sunat/NsCertificadoController.php(38): Greenter\XMLSecLibs\Certificate\X509Certificate->__construct('0\x82,\x05\x02\x01\x030\x82+\xCB\x06\t*\x86...', 'pB2kG9VVYn4M7GN...')
#2 [internal function]: App\Controllers\Sunat\NsCertificadoController->cer(Object(Slim\Http\Request), Object(Slim\Http\Response), Array)
#3 /AppServer/vendor/slim/slim/Slim/Handlers/Strategies/RequestResponse.php(41): call_user_func(Array, Object(Slim\Http\Request), Object(Slim\Http\Response), Array)
#4 /AppServer/vendor/slim/slim/Slim/Route.php(356): Slim\Handlers\Strategies\RequestResponse->__invoke(Array, Object(Slim\Http\Request), Object(Slim\Http\Response), Array)
#5 /AppServer/vendor/slim/slim/Slim/MiddlewareAwareTrait.php(117): Slim\Route->__invoke(Object(Slim\Http\Request), Object(Slim\Http\Response))
#6 /AppServer/vendor/slim/slim/Slim/Route.php(334): Slim\Route->callMiddlewareStack(Object(Slim\Http\Request), Object(Slim\Http\Response))
#7 /AppServer/vendor/slim/slim/Slim/App.php(515): Slim\Route->run(Object(Slim\Http\Request), Object(Slim\Http\Response))
#8 /AppServer/vendor/slim/slim/Slim/MiddlewareAwareTrait.php(117): Slim\App->__invoke(Object(Slim\Http\Request), Object(Slim\Http\Response))
#9 /AppServer/vendor/slim/slim/Slim/App.php(406): Slim\App->callMiddlewareStack(Object(Slim\Http\Request), Object(Slim\Http\Response))
#10 /AppServer/vendor/slim/slim/Slim/App.php(314): Slim\App->process(Object(Slim\Http\Request), Object(Slim\Http\Response))
#11 /AppServer/public/app/index.php(10): Slim\App->run()
#12 {main}

Warning: openssl_sign(): supplied key param cannot be coerced into a private key

Hola amigo estoy tratando de usar tu librería cifrando con un archivo de extension .p12

$fileXmlName = "/path/file/factura.xml";
$docXmlExport = $rootNode->asXML($fileXmlName);
$docXml = $rootNode->asXML();

    $certPath ="/path/file/key_example.p12"; 

    $signer = new SignedXml();
    $signer->setCertificateFromFile($certPath);

    $xmlSigned = $signer->signFromFile($fileXmlName);
    echo $xmlSigned;

al final me sale esta notificacion :
Warning: openssl_sign(): supplied key param cannot be coerced into a private key

Pdrias ayudarme o indicarme que estoy haciendo mal??

saludos

Values for getValidFrom() and getExpiration() are switched

Then functions getValidFrom() and getExpiration() in class x509Certificate.php seems to have returned values switched. getValidFrom() returns validTo_time_t and getExpiration() returns validFrom_time_t.

getValueFrom() should return value for validFrom_time_t.

Posición del Signature

Buenas consulta como puedo cambiar la posición del Signature es decir si le paso mi xml siempre me pone al final del todo.
Pero quiero que me coloque después de otra etiqueta que esta aproximadamente a la mitad del xml.

signFromFile return null

I'm doing the example of the README.md and at the moment of executing the method signFromFile returns a null value and does not sign the xml

this my code:

use Greenter\XMLSecLibs\Sunat\SignedXml;

require 'vendor/autoload.php';

$xmlPath = '20516109549-01-F001-70.xml';
$certPath = 'certificate.pem'; // Convertir pfx to pem

$signer = new SignedXml();
$signer->setCertificateFromFile($certPath);

$xmlSigned = $signer->signFromFile($xmlPath);

var_dump($xmlSigned);

Error exportando pfx a pem

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

remover ds:

Como se puede remover esto ? estuve mirando y hay un template, pero lo quito y aun asi los sigue coloando

Indicar passphrase para certificado con clave privada

Hola, estoy intentando firmar un xml con un certificado pem que tiene una clave privada, hasta donde he podido ver en la clase XMLSecurityKey se declara una variable publica como:
$passphrase = "";

Después de buscar un rato no he encontrado ningún setter para esta variable, la cosa es que necesito indicar el passphrase para poder firmar el documento ya que si no la función openssl_get_privatekey( ) (ubicada en la línea 345 del archivo XMLSecurityKey.php) me devuelve un false al pasarse la variable
$this->passphrase.

Toda ayuda es bienvenida.
Gracias!

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.