From fee20f1a60a6350aff8a4aa8de0982932afe6b81 Mon Sep 17 00:00:00 2001 From: igerasim Date: Wed, 17 Jan 2018 17:47:16 -0800 Subject: [PATCH] 8190674: sun/security/tools/jarsigner/TimestampCheck.java failed with java.nio.file.NoSuchFileException: ts2.cert Reviewed-by: mullan --- .../sun/security/tools/jarsigner/TimestampCheck.java | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/test/sun/security/tools/jarsigner/TimestampCheck.java b/test/sun/security/tools/jarsigner/TimestampCheck.java index ca676f414..ab11a8d58 100644 --- a/test/sun/security/tools/jarsigner/TimestampCheck.java +++ b/test/sun/security/tools/jarsigner/TimestampCheck.java @@ -684,11 +684,15 @@ public class TimestampCheck { gencert("ts", "-ext eku:critical=ts"); - // Issue another cert for "ts" with a different EKU. - // Length should be the same. Try several times. - keytool("-gencert -alias ca -infile ts.req -outfile ts2.cert " + - "-ext eku:critical=1.3.6.1.5.5.7.3.9"); for (int i = 0; i < 5; i++) { + // Issue another cert for "ts" with a different EKU. + // Length might be different because serial number is + // random. Try several times until a cert with the same + // length is generated so we can substitute ts.cert + // embedded in the PKCS7 block with ts2.cert. + // If cannot create one, related test will be ignored. + keytool("-gencert -alias ca -infile ts.req -outfile ts2.cert " + + "-ext eku:critical=1.3.6.1.5.5.7.3.9"); if (Files.size(Paths.get("ts.cert")) != Files.size(Paths.get("ts2.cert"))) { Files.delete(Paths.get("ts2.cert")); System.out.println("Warning: cannot create same length"); -- GitLab