Merge pull request #124 from WiredSpast/patch-1

Fix for certificatePath which includes spaces
This commit is contained in:
sirjonasxx 2022-04-10 14:12:00 +02:00 committed by GitHub
commit 8cd429cc23
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -25,7 +25,7 @@ public class NitroWindows implements NitroOsFunctions {
@Override
public boolean isRootCertificateTrusted(File certificate) {
try {
final String output = RuntimeUtil.getCommandOutput(new String[] {"cmd", "/c", " certutil.exe -f -verify " + certificate.getAbsolutePath()});
final String output = RuntimeUtil.getCommandOutput(new String[] {"cmd", "/c", " certutil.exe -f -verify \"" + certificate.getAbsolutePath() + "\""});
return !output.contains("CERT_TRUST_IS_UNTRUSTED_ROOT") &&
output.contains("dwInfoStatus=10c dwErrorStatus=0");
@ -41,7 +41,7 @@ public class NitroWindows implements NitroOsFunctions {
final String certificatePath = certificate.getAbsolutePath();
// Prompt UAC elevation.
WinDef.HINSTANCE result = NitroWindowsShell32.INSTANCE.ShellExecuteA(null, "runas", "cmd.exe", "/S /C \"certutil -addstore root " + certificatePath + "\"", null, 1);
WinDef.HINSTANCE result = NitroWindowsShell32.INSTANCE.ShellExecuteA(null, "runas", "cmd.exe", "/S /C 'certutil -addstore root \"" + certificatePath + "\"'", null, 1);
// Wait for exit.
Kernel32.INSTANCE.WaitForSingleObject(result, WinBase.INFINITE);