Skip to content

Commit a0f7982

Browse files
myankelevwangweij
authored andcommitted
8345134: Test sun/security/tools/jarsigner/ConciseJarsigner.java failed: unable to find valid certification path to requested target
Reviewed-by: weijun
1 parent 63cedaf commit a0f7982

File tree

1 file changed

+10
-3
lines changed

1 file changed

+10
-3
lines changed

test/jdk/sun/security/tools/jarsigner/ConciseJarsigner.java

+10-3
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright (c) 2009, 2021, Oracle and/or its affiliates. All rights reserved.
2+
* Copyright (c) 2009, 2025, Oracle and/or its affiliates. All rights reserved.
33
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
44
*
55
* This code is free software; you can redistribute it and/or modify it
@@ -43,8 +43,15 @@ public class ConciseJarsigner {
4343
static OutputAnalyzer kt(String cmd) throws Exception {
4444
// Choose 2048-bit RSA to make sure it runs fine and fast. In
4545
// fact, every keyalg/keysize combination is OK for this test.
46-
return SecurityTools.keytool("-storepass changeit -keypass changeit "
47-
+ "-keystore ks -keyalg rsa -keysize 2048 " + cmd);
46+
// The start date is set to -1M to prevent the certificate not yet valid during fast enough execution.
47+
// If -startdate is specified in cmd, cmd version will be used.
48+
if (cmd.contains("-startdate")) {
49+
return SecurityTools.keytool("-storepass changeit -keypass changeit "
50+
+ "-keystore ks -keyalg rsa -keysize 2048 " + cmd);
51+
} else {
52+
return SecurityTools.keytool("-storepass changeit -keypass changeit "
53+
+ "-keystore ks -keyalg rsa -keysize 2048 -startdate -1M " + cmd);
54+
}
4855
}
4956

5057
static void gencert(String owner, String cmd) throws Exception {

0 commit comments

Comments
 (0)