From f436532c24b7a71322434f023ce5b3cb81460f11 Mon Sep 17 00:00:00 2001 From: Judah Gabriel Himango Date: Wed, 22 Jan 2020 14:29:14 -0800 Subject: [PATCH] Escaping user input to key tool Fixes the issue where e.g. the key password contains a hyphen. --- src/lib/jdk/KeyTool.ts | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/lib/jdk/KeyTool.ts b/src/lib/jdk/KeyTool.ts index 14fca360..f1346e7f 100644 --- a/src/lib/jdk/KeyTool.ts +++ b/src/lib/jdk/KeyTool.ts @@ -66,10 +66,10 @@ export class KeyTool { '-genkeypair', `-dname "cn=${keyOptions.fullName}, ou=${keyOptions.organizationalUnit}, ` + `o=${keyOptions.organization}, c=${keyOptions.country}"`, - `-alias ${keyOptions.alias}`, - `-keypass ${keyOptions.keypassword}`, - `-keystore ${keyOptions.path}`, - `-storepass ${keyOptions.password}`, + `-alias \"${keyOptions.alias}\"`, + `-keypass \"${keyOptions.keypassword}\"`, + `-keystore \"${keyOptions.path}\"`, + `-storepass \"${keyOptions.password}\"`, '-validity 20000', '-keyalg RSA', ];