openssl-nodejs icon indicating copy to clipboard operation
openssl-nodejs copied to clipboard

OpenSSL process ends with code 1

Open rmittl opened this issue 3 years ago • 1 comments

I tried to run the following openssl command: openssl pkcs12 -in .p12 -clcerts -nokeys -out signerCert.pem -passin pass:

in Nodejs looks like this: openssl(['pkcs12', '-config', { name:'cer.p12', buffer: buffervar }, '-clcerts', '-nokeys', '-out', 'Cer.pem', '-passin', 'pass:password'], function (err, buffer) { console.log(err.toString(), buffer.toString()); });

I get always the errror OpenSSL process ends with code 1 [💻] Usage: pkcs12 [options] [💻] where options are [💻] -export output PKCS12 file [💻] -chain add certificate chain [💻] -inkey file private key if not infile [💻] -certfile f add all certs in f....

If I do it without password, then I get the same error. Where is my issue? At the terminal it runs. Thanks in advance.

rmittl avatar Mar 06 '22 07:03 rmittl

Hi @rmittl I experienced the same thing. I think it's because it spawns a new task to execute the command. Try adding a short 250 ms delay after your command and see if it gives the task time to execute and close. Worked for me.

monkeytronics avatar Apr 11 '23 00:04 monkeytronics