Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,7 @@ public class URLClassPath {
private static final boolean JAR_CHECKING_ENABLED;
private static final boolean DISABLE_CP_URL_CHECK;
private static final boolean DEBUG_CP_URL_CHECK;
private static final boolean VERIFY_SIGNED_JAR;

static {
Properties props = System.getProperties();
Expand All @@ -95,6 +96,8 @@ public class URLClassPath {
// the check is not disabled).
p = props.getProperty("jdk.net.URLClassPath.showIgnoredClassPathEntries");
DEBUG_CP_URL_CHECK = p != null ? p.equals("true") || p.isEmpty() : false;
p = props.getProperty("jdk.verifySignedJar");
VERIFY_SIGNED_JAR = p != null ? p.equals("true") || p.isEmpty() : false;
}

/* Search path of URLs passed to the constructor or by calls to addURL.
Expand Down Expand Up @@ -685,7 +688,7 @@ private JarFile getJarFile(URL url) throws IOException {
if (!p.exists()) {
throw new FileNotFoundException(p.getPath());
}
return checkJar(new JarFile(new File(p.getPath()), true, ZipFile.OPEN_READ,
return checkJar(new JarFile(new File(p.getPath()), VERIFY_SIGNED_JAR, ZipFile.OPEN_READ,
JarFile.runtimeVersion()));
}
@SuppressWarnings("deprecation")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -631,7 +631,7 @@ private Set<String> jarPackages(JarFile jf) {
*/
private ModuleReference readJar(Path file) throws IOException {
try (JarFile jf = new JarFile(file.toFile(),
true, // verify
false, // verify
ZipFile.OPEN_READ,
releaseVersion))
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -236,7 +236,7 @@ static class JarModuleReader extends SafeCloseModuleReader {
static JarFile newJarFile(String path) {
try {
return new JarFile(new File(path),
true, // verify
false, // verify
ZipFile.OPEN_READ,
JarFile.runtimeVersion());
} catch (IOException ioe) {
Expand Down
2 changes: 2 additions & 0 deletions test/jdk/java/security/Security/signedfirst/DynStatic.java
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,7 @@ public static void main(String[] args) throws Exception {
// Run the DynSignedProvFirst test program
ProcessTools.executeTestJava("-classpath",
TEST_CLASSES.toString() + File.pathSeparator + "exp.jar",
"-Djdk.verifySignedJar=true",
"DynSignedProvFirst")
.shouldContain("test passed");

Expand All @@ -88,6 +89,7 @@ public static void main(String[] args) throws Exception {
ProcessTools.executeTestJava("-classpath",
TEST_CLASSES.toString() + File.pathSeparator + "exp.jar",
"-Djava.security.properties=" + STATIC_PROPS.toUri(),
"-Djdk.verifySignedJar=true",
"StaticSignedProvFirst")
.shouldContain("test passed");
}
Expand Down