8225748: Use SHA-256 for javap classfile checksum
Reviewed-by: mchung
This commit is contained in:
parent
2cf9999ae2
commit
454f9f9fd0
@ -477,7 +477,7 @@ public class Main {
|
||||
}
|
||||
|
||||
try (InputStream in = getClass().getResourceAsStream('/' + className.replace('.', '/') + ".class")) {
|
||||
final String algorithm = "MD5";
|
||||
final String algorithm = "SHA-256";
|
||||
byte[] digest;
|
||||
MessageDigest md = MessageDigest.getInstance(algorithm);
|
||||
try (DigestInputStream din = new DigestInputStream(in, md)) {
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2007, 2018, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 2007, 2019, Oracle and/or its affiliates. All rights reserved.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
@ -808,7 +808,7 @@ public class JavapTask implements DisassemblerTool.DisassemblerTask, Messages {
|
||||
MessageDigest md = null;
|
||||
if (options.sysInfo || options.verbose) {
|
||||
try {
|
||||
md = MessageDigest.getInstance("MD5");
|
||||
md = MessageDigest.getInstance("SHA-256");
|
||||
} catch (NoSuchAlgorithmException ignore) {
|
||||
}
|
||||
in = new DigestInputStream(in, md);
|
||||
@ -829,7 +829,7 @@ public class JavapTask implements DisassemblerTool.DisassemblerTask, Messages {
|
||||
if (options.sysInfo || options.verbose) {
|
||||
classWriter.setFile(info.fo.toUri());
|
||||
classWriter.setLastModified(info.fo.getLastModified());
|
||||
classWriter.setDigest("MD5", info.digest);
|
||||
classWriter.setDigest("SHA-256", info.digest);
|
||||
classWriter.setFileSize(info.size);
|
||||
}
|
||||
|
||||
|
@ -99,7 +99,7 @@ main.opt.constants=\
|
||||
\ -constants Show final constants
|
||||
|
||||
main.opt.sysinfo=\
|
||||
\ -sysinfo Show system info (path, size, date, MD5 hash)\n\
|
||||
\ -sysinfo Show system info (path, size, date, SHA-256 hash)\n\
|
||||
\ of class being processed
|
||||
|
||||
main.opt.module=\
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2010, 2015, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 2010, 2019, Oracle and/or its affiliates. All rights reserved.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
@ -23,7 +23,7 @@
|
||||
|
||||
/*
|
||||
* @test
|
||||
* @bug 6942649
|
||||
* @bug 6942649 8225748
|
||||
* @summary add hidden option to identify location and version of javac classes
|
||||
* @modules jdk.compiler
|
||||
*/
|
||||
@ -60,7 +60,7 @@ public class T6942649 {
|
||||
throw new Exception("location of class not found in output");
|
||||
}
|
||||
|
||||
if (!out.contains("MD5 checksum: "))
|
||||
if (!out.contains("SHA-256 checksum: "))
|
||||
throw new Exception("checksum not found in output");
|
||||
}
|
||||
}
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2008, 2016, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 2008, 2019, Oracle and/or its affiliates. All rights reserved.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
@ -23,7 +23,7 @@
|
||||
|
||||
/*
|
||||
* @test
|
||||
* @bug 4884240
|
||||
* @bug 4884240 8225748
|
||||
* @summary additional option required for javap
|
||||
* @modules jdk.jdeps/com.sun.tools.javap
|
||||
*/
|
||||
@ -47,7 +47,7 @@ public class T4884240 {
|
||||
if (lines.length < 3
|
||||
|| !lines[0].trim().startsWith("Classfile")
|
||||
|| !lines[1].trim().startsWith("Last modified")
|
||||
|| !lines[2].trim().startsWith("MD5")) {
|
||||
|| !lines[2].trim().startsWith("SHA-256")) {
|
||||
System.out.println(sw);
|
||||
throw new Exception("unexpected output");
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user