From 90691b606e22c0a4b20f7050cfe03fc47c2bbfe7 Mon Sep 17 00:00:00 2001 From: Joaquim Alvino de Mesquita Neto Date: Tue, 6 Feb 2024 16:46:48 +0100 Subject: [PATCH] Openssl pkcs12 run on test now tries with and without -legacy (#22) openssl pkcs12 run on test now tries with and without -legacy --- .../com/wooga/security/SecurityHelper.groovy | 20 +++++++++++++++---- 1 file changed, 16 insertions(+), 4 deletions(-) diff --git a/src/test/groovy/com/wooga/security/SecurityHelper.groovy b/src/test/groovy/com/wooga/security/SecurityHelper.groovy index 2996e85..f6d86b4 100644 --- a/src/test/groovy/com/wooga/security/SecurityHelper.groovy +++ b/src/test/groovy/com/wooga/security/SecurityHelper.groovy @@ -253,15 +253,27 @@ class SecurityHelper { '-passout', "pass:${password}", '-legacy' ] def sout = new StringBuilder(), serr = new StringBuilder() + + //run with -legacy def proc = args.execute() proc.consumeProcessOutput(sout, serr) if (proc.waitFor() == 0) { + // if success, great, we have our result + return p12 + } + + //if -legacy fails, run without -legacy + args = args.remove('-legacy') + proc = args.execute() + proc.consumeProcessOutput(sout, serr) + if(proc.waitFor() == 0) { + //success without -legacy, we have our result return p12 - } else { - println(sout) - println("====stderr====") - println(serr) } + //on error, print process output to help with debug + println(sout) + println("====stderr====") + println(serr) return null }