by garroyo » Sat Feb 12, 2022 4:49 pm
I am trying to sign an .xml with digital certificate with an external program called AutoSignature, by passing parameters to it through the command line and using application.executeprogram.
I know that the parameters to pass to it so that it can be executed are correct since in cmd it is executed without problems. But when trying to run it on Servoy using application.executeprogram doesn't work.
On the command line the instruction would be:
AutoFirmaCommandLine.exe sign -certgui -i D:\\descargas\\FacturaE321.xml -o D:\\tmp\\test-firma.signed -format XadES -store windows -filter subject.contains:12710839G -xml -config xadesSignFormat ="XAdES Enveloped"
The parameters that I try to pass are correct because in cmd they work for me, but I don't know what I could be doing wrong because it doesn't execute in servoy.
If someone could tell me what I may be doing wrong I would appreciate it.
This is my code in Servoy.
//is the full path of the program to be executed.
var ruta_app = "D:\\Program Files\\AutoFirma\\AutoFirma\\AutoFirmaCommandLine.exe";
//Arguments passed to the program
var params = [" sign", " -certgui", " -i D:\\descargas\\FacturaE321.xml", " -o D:\\tmp\\test-firma.signed ", " -format XadES", " -store windows", " -filter subject.contains:12710839G", " -xml", " -config xadesSignFormat=\"XAdES Enveloped\""];
//directory from which your program start executing.
var startdirectory = "D:\\Program Files\\AutoFirma\\AutoFirma\\";
//environment variables passed to the program
var enviromentvariables = null;
var str = application.executeProgram(ruta_app, params, null, startdirectory);
This is Servoy said about the instruction of the command line
Unrecognized command: sign
...
Use "AutoSignature cmd -help" to see the syntax of the "cmd" command