I am facing a problem while executing openSSL command using my jar in Ubuntu environemnt. I have concluded that this is happening because of the space in the path of the fil
cmdGetAlgorithm[0] = "openssl x509 -in"; ...
As @immibis stated in the comments, arg[0]
is the program name. So the vector should look something like:
cmdArg[0] = "/usr/local/ssl/bin/openssl";
cmdArg[1] = "x509";
cmdArg[2] = "-in";
cmdArg[3] = certFilePAth;
cmdArg[4] = "-noout"
cmdArg[5] = "-text";
cmdArg[6] = "-certopt";
cmdArg[7] = "no_subject,no_header,no_version,no_serial,no_validity," +
"no_issuer,no_pubkey,no_sigdump,no_aux,no_extensions ";
You should always specify the complete filename of the executable to ensure you are running the intended executable, and not something planted by an adversary.