I do the following:
我做了以下事情:
File tmpDir = com.google.common.io.Files.createTempDir();
tmpDir.deleteOnExit();
// determine command based upon OS
String prefix = "pk12util";
String command = String.format(
"-i %s -d sql:%s -W '' -K ''",
cert.getAbsolutePath(), tmpDir.getAbsolutePath());
// run the command
CommandRunner.run(prefix, command);
CommandRunner is a wrapper around the java ProcessBuilder. It handles creating the process, returning command output and exit status.
CommandRunner是java ProcessBuilder的包装器。它处理创建进程,返回命令输出和退出状态。
Here is the command being run from the java process and the corresponding output.
这是从java进程运行的命令和相应的输出。
pk12util -i a-typical-tls-cert.p12 -d sql:/tmpdirpath -W '' -K ''
pk12util -i a-typical-tls-cert.p12 -d sql:/ tmpdirpath -W''-K''
pk12util: function failed: security library: bad database.
pk12util:功能失败:安全库:坏数据库。
When I copy and paste the command I am running from the java process it completes successfully. I verified permissions on the certdir. I even tried running the -N on the tmpDir which yields no resolution. Anyone have any suggestions? I tried to dig through the source code for the pk12util for the error but couldn't find anything pertinent.
当我从java进程复制并粘贴我正在运行的命令时,它成功完成。我验证了certdir的权限。我甚至尝试在tmpDir上运行-N而不产生分辨率。有人有什么建议吗?我试图挖掘pk12util的源代码以查找错误,但找不到任何相关内容。
1 个解决方案
#1
0
I am not sure if anyone else will be doing this but I solved the issue by modifying my CommandRunner from using the ProcessBuilder to use using the Runtime.getRuntime().exec(command). I don't understand why the process builder was failing versus the runtime#exec.
我不确定是否有其他人会这样做但我通过修改我的CommandRunner使用ProcessBuilder来使用Runtime.getRuntime()。exec(命令)来解决这个问题。我不明白为什么进程构建器失败而不是运行时#exec。
#1
0
I am not sure if anyone else will be doing this but I solved the issue by modifying my CommandRunner from using the ProcessBuilder to use using the Runtime.getRuntime().exec(command). I don't understand why the process builder was failing versus the runtime#exec.
我不确定是否有其他人会这样做但我通过修改我的CommandRunner使用ProcessBuilder来使用Runtime.getRuntime()。exec(命令)来解决这个问题。我不明白为什么进程构建器失败而不是运行时#exec。