提交 b972dbd3 编写于 作者: A asaha

Merge

...@@ -643,6 +643,9 @@ d689f7b806c89e535f784ba94bea1ae129ee0f19 jdk8u111-b05 ...@@ -643,6 +643,9 @@ d689f7b806c89e535f784ba94bea1ae129ee0f19 jdk8u111-b05
c959cff8f7accc5dc2a334a977a95fe1dcb9e812 jdk8u111-b09 c959cff8f7accc5dc2a334a977a95fe1dcb9e812 jdk8u111-b09
1f15a299d2bf9a8bed33a2bdf36745c8238aafbb jdk8u111-b10 1f15a299d2bf9a8bed33a2bdf36745c8238aafbb jdk8u111-b10
28e488c17b7a276e9ce00a0488bbc53094294e14 jdk8u111-b11 28e488c17b7a276e9ce00a0488bbc53094294e14 jdk8u111-b11
b1304d71a2ec04ae6fa0a46120a5beba40a6f5ba jdk8u111-b12
3f1a07c3a600abdc2eb204f9b67984e6b920846e jdk8u111-b13
ab26fe28f9ed9c7d0a03ce47d1306427f86f27e9 jdk8u111-b14
47e20a90bdbb2327289e330606b73a9fe4dc857e jdk8u112-b00 47e20a90bdbb2327289e330606b73a9fe4dc857e jdk8u112-b00
96393e490afd4acba5b92c5ede68dc9bbb60a38e jdk8u112-b01 96393e490afd4acba5b92c5ede68dc9bbb60a38e jdk8u112-b01
b44d695f738baba091370828b84ae2c4cd715c1b jdk8u112-b02 b44d695f738baba091370828b84ae2c4cd715c1b jdk8u112-b02
...@@ -655,3 +658,7 @@ c66f5a825a0f0b5fb833bc7f50f327aec43e213b jdk8u112-b07 ...@@ -655,3 +658,7 @@ c66f5a825a0f0b5fb833bc7f50f327aec43e213b jdk8u112-b07
c86d82567b1200bdb2d2a757f676179a637c4244 jdk8u112-b10 c86d82567b1200bdb2d2a757f676179a637c4244 jdk8u112-b10
532df0329e8070a75ae229310aa87ae530fa1eee jdk8u112-b11 532df0329e8070a75ae229310aa87ae530fa1eee jdk8u112-b11
2a44e743f1654e39109233322e639bcfeca42e8d jdk8u112-b12 2a44e743f1654e39109233322e639bcfeca42e8d jdk8u112-b12
16c649b70dc3d437ab16ff8125a50125deda2bc9 jdk8u112-b13
d2d8b67021a0f41e0eabd711bfd87a943dc0a8d5 jdk8u112-b14
60767ec3909b3d0cb26dd7b3f952c62053719dda jdk8u112-b15
5dd7e4bae5c2f1ee4f80c5570e7e3e2f715f7a32 jdk8u112-b16
...@@ -55,6 +55,7 @@ import sun.security.util.DerInputStream; ...@@ -55,6 +55,7 @@ import sun.security.util.DerInputStream;
import sun.security.util.DerOutputStream; import sun.security.util.DerOutputStream;
import sun.security.util.DerValue; import sun.security.util.DerValue;
import sun.security.util.DisabledAlgorithmConstraints; import sun.security.util.DisabledAlgorithmConstraints;
import sun.security.util.KeyUtil;
import sun.security.util.ObjectIdentifier; import sun.security.util.ObjectIdentifier;
import sun.security.x509.AlgorithmId; import sun.security.x509.AlgorithmId;
import sun.security.x509.X500Name; import sun.security.x509.X500Name;
...@@ -399,7 +400,9 @@ public class SignerInfo implements DerEncoder { ...@@ -399,7 +400,9 @@ public class SignerInfo implements DerEncoder {
// check if the public key is restricted // check if the public key is restricted
if (!JAR_DISABLED_CHECK.permits(SIG_PRIMITIVE_SET, key)) { if (!JAR_DISABLED_CHECK.permits(SIG_PRIMITIVE_SET, key)) {
throw new SignatureException("Public key check failed. " + throw new SignatureException("Public key check failed. " +
"Disabled algorithm used: " + key.getAlgorithm()); "Disabled key used: " +
KeyUtil.getKeySize(key) + " bit " +
key.getAlgorithm());
} }
if (cert.hasUnsupportedCriticalExtension()) { if (cert.hasUnsupportedCriticalExtension()) {
......
...@@ -603,6 +603,7 @@ public class Main { ...@@ -603,6 +603,7 @@ public class Main {
} }
Manifest man = jf.getManifest(); Manifest man = jf.getManifest();
boolean hasSignature = false;
// The map to record display info, only used when -verbose provided // The map to record display info, only used when -verbose provided
// key: signer info string // key: signer info string
...@@ -618,6 +619,10 @@ public class Main { ...@@ -618,6 +619,10 @@ public class Main {
while (e.hasMoreElements()) { while (e.hasMoreElements()) {
JarEntry je = e.nextElement(); JarEntry je = e.nextElement();
String name = je.getName(); String name = je.getName();
hasSignature = hasSignature
|| SignatureFileVerifier.isBlockOrSF(name);
CodeSigner[] signers = je.getCodeSigners(); CodeSigner[] signers = je.getCodeSigners();
boolean isSigned = (signers != null); boolean isSigned = (signers != null);
anySigned |= isSigned; anySigned |= isSigned;
...@@ -757,8 +762,11 @@ public class Main { ...@@ -757,8 +762,11 @@ public class Main {
System.out.println(rb.getString("no.manifest.")); System.out.println(rb.getString("no.manifest."));
if (!anySigned) { if (!anySigned) {
System.out.println(rb.getString( if (hasSignature) {
"jar.is.unsigned.signatures.missing.or.not.parsable.")); System.out.println(rb.getString("jar.treated.unsigned"));
} else {
System.out.println(rb.getString("jar.is.unsigned"));
}
} else { } else {
boolean warningAppeared = false; boolean warningAppeared = false;
boolean errorAppeared = false; boolean errorAppeared = false;
......
...@@ -135,8 +135,10 @@ public class Resources extends java.util.ListResourceBundle { ...@@ -135,8 +135,10 @@ public class Resources extends java.util.ListResourceBundle {
{"no.manifest.", "no manifest."}, {"no.manifest.", "no manifest."},
{".Signature.related.entries.","(Signature related entries)"}, {".Signature.related.entries.","(Signature related entries)"},
{".Unsigned.entries.", "(Unsigned entries)"}, {".Unsigned.entries.", "(Unsigned entries)"},
{"jar.is.unsigned.signatures.missing.or.not.parsable.", {"jar.is.unsigned",
"jar is unsigned. (signatures missing or not parsable)"}, "jar is unsigned."},
{"jar.treated.unsigned",
"Signature not parsable or verifiable. The jar will be treated as unsigned. The jar may have been signed with a weak algorithm that is now disabled. For more information, rerun jarsigner with debug enabled (-J-Djava.security.debug=jar)."},
{"jar.signed.", "jar signed."}, {"jar.signed.", "jar signed."},
{"jar.signed.with.signer.errors.", "jar signed, with signer errors."}, {"jar.signed.with.signer.errors.", "jar signed, with signer errors."},
{"jar.verified.", "jar verified."}, {"jar.verified.", "jar verified."},
......
...@@ -660,4 +660,4 @@ jdk.tls.legacyAlgorithms= \ ...@@ -660,4 +660,4 @@ jdk.tls.legacyAlgorithms= \
# implementation. It is not guaranteed to be examined and used by other # implementation. It is not guaranteed to be examined and used by other
# implementations. # implementations.
# #
jdk.jar.disabledAlgorithms=MD2, MD5, RSA keySize < 1024 jdk.jar.disabledAlgorithms=MD2, RSA keySize < 1024
...@@ -660,4 +660,4 @@ jdk.tls.legacyAlgorithms= \ ...@@ -660,4 +660,4 @@ jdk.tls.legacyAlgorithms= \
# implementation. It is not guaranteed to be examined and used by other # implementation. It is not guaranteed to be examined and used by other
# implementations. # implementations.
# #
jdk.jar.disabledAlgorithms=MD2, MD5, RSA keySize < 1024 jdk.jar.disabledAlgorithms=MD2, RSA keySize < 1024
...@@ -663,4 +663,4 @@ jdk.tls.legacyAlgorithms= \ ...@@ -663,4 +663,4 @@ jdk.tls.legacyAlgorithms= \
# implementation. It is not guaranteed to be examined and used by other # implementation. It is not guaranteed to be examined and used by other
# implementations. # implementations.
# #
jdk.jar.disabledAlgorithms=MD2, MD5, RSA keySize < 1024 jdk.jar.disabledAlgorithms=MD2, RSA keySize < 1024
...@@ -662,4 +662,4 @@ jdk.tls.legacyAlgorithms= \ ...@@ -662,4 +662,4 @@ jdk.tls.legacyAlgorithms= \
# implementation. It is not guaranteed to be examined and used by other # implementation. It is not guaranteed to be examined and used by other
# implementations. # implementations.
# #
jdk.jar.disabledAlgorithms=MD2, MD5, RSA keySize < 1024 jdk.jar.disabledAlgorithms=MD2, RSA keySize < 1024
...@@ -663,4 +663,4 @@ jdk.tls.legacyAlgorithms= \ ...@@ -663,4 +663,4 @@ jdk.tls.legacyAlgorithms= \
# implementation. It is not guaranteed to be examined and used by other # implementation. It is not guaranteed to be examined and used by other
# implementations. # implementations.
# #
jdk.jar.disabledAlgorithms=MD2, MD5, RSA keySize < 1024 jdk.jar.disabledAlgorithms=MD2, RSA keySize < 1024
...@@ -90,13 +90,14 @@ public final class OutputAnalyzer { ...@@ -90,13 +90,14 @@ public final class OutputAnalyzer {
* @throws RuntimeException * @throws RuntimeException
* If the string was not found * If the string was not found
*/ */
public void shouldContain(String expectedString) { public OutputAnalyzer shouldContain(String expectedString) {
if (!stdout.contains(expectedString) if (!stdout.contains(expectedString)
&& !stderr.contains(expectedString)) { && !stderr.contains(expectedString)) {
reportDiagnosticSummary(); reportDiagnosticSummary();
throw new RuntimeException("'" + expectedString throw new RuntimeException("'" + expectedString
+ "' missing from stdout/stderr \n"); + "' missing from stdout/stderr \n");
} }
return this;
} }
/** /**
...@@ -107,12 +108,13 @@ public final class OutputAnalyzer { ...@@ -107,12 +108,13 @@ public final class OutputAnalyzer {
* @throws RuntimeException * @throws RuntimeException
* If the string was not found * If the string was not found
*/ */
public void stdoutShouldContain(String expectedString) { public OutputAnalyzer stdoutShouldContain(String expectedString) {
if (!stdout.contains(expectedString)) { if (!stdout.contains(expectedString)) {
reportDiagnosticSummary(); reportDiagnosticSummary();
throw new RuntimeException("'" + expectedString throw new RuntimeException("'" + expectedString
+ "' missing from stdout \n"); + "' missing from stdout \n");
} }
return this;
} }
/** /**
...@@ -123,24 +125,25 @@ public final class OutputAnalyzer { ...@@ -123,24 +125,25 @@ public final class OutputAnalyzer {
* @throws RuntimeException * @throws RuntimeException
* If the string was not found * If the string was not found
*/ */
public void stderrShouldContain(String expectedString) { public OutputAnalyzer stderrShouldContain(String expectedString) {
if (!stderr.contains(expectedString)) { if (!stderr.contains(expectedString)) {
reportDiagnosticSummary(); reportDiagnosticSummary();
throw new RuntimeException("'" + expectedString throw new RuntimeException("'" + expectedString
+ "' missing from stderr \n"); + "' missing from stderr \n");
} }
return this;
} }
/** /**
* Verify that the stdout and stderr contents of output buffer does not * Verify that the stdout and stderr contents of output buffer does not
* contain the string * contain the string
* *
* @param expectedString * @param notExpectedString
* String that the buffer should not contain * String that the buffer should not contain
* @throws RuntimeException * @throws RuntimeException
* If the string was found * If the string was found
*/ */
public void shouldNotContain(String notExpectedString) { public OutputAnalyzer shouldNotContain(String notExpectedString) {
if (stdout.contains(notExpectedString)) { if (stdout.contains(notExpectedString)) {
reportDiagnosticSummary(); reportDiagnosticSummary();
throw new RuntimeException("'" + notExpectedString throw new RuntimeException("'" + notExpectedString
...@@ -151,23 +154,25 @@ public final class OutputAnalyzer { ...@@ -151,23 +154,25 @@ public final class OutputAnalyzer {
throw new RuntimeException("'" + notExpectedString throw new RuntimeException("'" + notExpectedString
+ "' found in stderr \n"); + "' found in stderr \n");
} }
return this;
} }
/** /**
* Verify that the stdout contents of output buffer does not contain the * Verify that the stdout contents of output buffer does not contain the
* string * string
* *
* @param expectedString * @param notExpectedString
* String that the buffer should not contain * String that the buffer should not contain
* @throws RuntimeException * @throws RuntimeException
* If the string was found * If the string was found
*/ */
public void stdoutShouldNotContain(String notExpectedString) { public OutputAnalyzer stdoutShouldNotContain(String notExpectedString) {
if (stdout.contains(notExpectedString)) { if (stdout.contains(notExpectedString)) {
reportDiagnosticSummary(); reportDiagnosticSummary();
throw new RuntimeException("'" + notExpectedString throw new RuntimeException("'" + notExpectedString
+ "' found in stdout \n"); + "' found in stdout \n");
} }
return this;
} }
/** /**
...@@ -195,7 +200,7 @@ public final class OutputAnalyzer { ...@@ -195,7 +200,7 @@ public final class OutputAnalyzer {
* @throws RuntimeException * @throws RuntimeException
* If the pattern was not found * If the pattern was not found
*/ */
public void shouldMatch(String pattern) { public OutputAnalyzer shouldMatch(String pattern) {
Matcher stdoutMatcher = Pattern.compile(pattern, Pattern.MULTILINE) Matcher stdoutMatcher = Pattern.compile(pattern, Pattern.MULTILINE)
.matcher(stdout); .matcher(stdout);
Matcher stderrMatcher = Pattern.compile(pattern, Pattern.MULTILINE) Matcher stderrMatcher = Pattern.compile(pattern, Pattern.MULTILINE)
...@@ -205,6 +210,7 @@ public final class OutputAnalyzer { ...@@ -205,6 +210,7 @@ public final class OutputAnalyzer {
throw new RuntimeException("'" + pattern throw new RuntimeException("'" + pattern
+ "' missing from stdout/stderr \n"); + "' missing from stdout/stderr \n");
} }
return this;
} }
/** /**
...@@ -214,7 +220,7 @@ public final class OutputAnalyzer { ...@@ -214,7 +220,7 @@ public final class OutputAnalyzer {
* @throws RuntimeException * @throws RuntimeException
* If the pattern was not found * If the pattern was not found
*/ */
public void stdoutShouldMatch(String pattern) { public OutputAnalyzer stdoutShouldMatch(String pattern) {
Matcher matcher = Pattern.compile(pattern, Pattern.MULTILINE).matcher( Matcher matcher = Pattern.compile(pattern, Pattern.MULTILINE).matcher(
stdout); stdout);
if (!matcher.find()) { if (!matcher.find()) {
...@@ -222,6 +228,7 @@ public final class OutputAnalyzer { ...@@ -222,6 +228,7 @@ public final class OutputAnalyzer {
throw new RuntimeException("'" + pattern throw new RuntimeException("'" + pattern
+ "' missing from stdout \n"); + "' missing from stdout \n");
} }
return this;
} }
/** /**
...@@ -231,7 +238,7 @@ public final class OutputAnalyzer { ...@@ -231,7 +238,7 @@ public final class OutputAnalyzer {
* @throws RuntimeException * @throws RuntimeException
* If the pattern was not found * If the pattern was not found
*/ */
public void stderrShouldMatch(String pattern) { public OutputAnalyzer stderrShouldMatch(String pattern) {
Matcher matcher = Pattern.compile(pattern, Pattern.MULTILINE).matcher( Matcher matcher = Pattern.compile(pattern, Pattern.MULTILINE).matcher(
stderr); stderr);
if (!matcher.find()) { if (!matcher.find()) {
...@@ -239,6 +246,7 @@ public final class OutputAnalyzer { ...@@ -239,6 +246,7 @@ public final class OutputAnalyzer {
throw new RuntimeException("'" + pattern throw new RuntimeException("'" + pattern
+ "' missing from stderr \n"); + "' missing from stderr \n");
} }
return this;
} }
/** /**
...@@ -249,7 +257,7 @@ public final class OutputAnalyzer { ...@@ -249,7 +257,7 @@ public final class OutputAnalyzer {
* @throws RuntimeException * @throws RuntimeException
* If the pattern was found * If the pattern was found
*/ */
public void shouldNotMatch(String pattern) { public OutputAnalyzer shouldNotMatch(String pattern) {
Matcher matcher = Pattern.compile(pattern, Pattern.MULTILINE).matcher( Matcher matcher = Pattern.compile(pattern, Pattern.MULTILINE).matcher(
stdout); stdout);
if (matcher.find()) { if (matcher.find()) {
...@@ -263,6 +271,7 @@ public final class OutputAnalyzer { ...@@ -263,6 +271,7 @@ public final class OutputAnalyzer {
throw new RuntimeException("'" + pattern + "' found in stderr: '" throw new RuntimeException("'" + pattern + "' found in stderr: '"
+ matcher.group() + "' \n"); + matcher.group() + "' \n");
} }
return this;
} }
/** /**
...@@ -273,13 +282,14 @@ public final class OutputAnalyzer { ...@@ -273,13 +282,14 @@ public final class OutputAnalyzer {
* @throws RuntimeException * @throws RuntimeException
* If the pattern was found * If the pattern was found
*/ */
public void stdoutShouldNotMatch(String pattern) { public OutputAnalyzer stdoutShouldNotMatch(String pattern) {
Matcher matcher = Pattern.compile(pattern, Pattern.MULTILINE).matcher( Matcher matcher = Pattern.compile(pattern, Pattern.MULTILINE).matcher(
stdout); stdout);
if (matcher.find()) { if (matcher.find()) {
reportDiagnosticSummary(); reportDiagnosticSummary();
throw new RuntimeException("'" + pattern + "' found in stdout \n"); throw new RuntimeException("'" + pattern + "' found in stdout \n");
} }
return this;
} }
/** /**
...@@ -290,13 +300,14 @@ public final class OutputAnalyzer { ...@@ -290,13 +300,14 @@ public final class OutputAnalyzer {
* @throws RuntimeException * @throws RuntimeException
* If the pattern was found * If the pattern was found
*/ */
public void stderrShouldNotMatch(String pattern) { public OutputAnalyzer stderrShouldNotMatch(String pattern) {
Matcher matcher = Pattern.compile(pattern, Pattern.MULTILINE).matcher( Matcher matcher = Pattern.compile(pattern, Pattern.MULTILINE).matcher(
stderr); stderr);
if (matcher.find()) { if (matcher.find()) {
reportDiagnosticSummary(); reportDiagnosticSummary();
throw new RuntimeException("'" + pattern + "' found in stderr \n"); throw new RuntimeException("'" + pattern + "' found in stderr \n");
} }
return this;
} }
/** /**
...@@ -344,12 +355,13 @@ public final class OutputAnalyzer { ...@@ -344,12 +355,13 @@ public final class OutputAnalyzer {
* If the exit value from the process did not match the expected * If the exit value from the process did not match the expected
* value * value
*/ */
public void shouldHaveExitValue(int expectedExitValue) { public OutputAnalyzer shouldHaveExitValue(int expectedExitValue) {
if (getExitValue() != expectedExitValue) { if (getExitValue() != expectedExitValue) {
reportDiagnosticSummary(); reportDiagnosticSummary();
throw new RuntimeException("Expected to get exit value of [" throw new RuntimeException("Expected to get exit value of ["
+ expectedExitValue + "]\n"); + expectedExitValue + "]\n");
} }
return this;
} }
/** /**
...@@ -357,11 +369,12 @@ public final class OutputAnalyzer { ...@@ -357,11 +369,12 @@ public final class OutputAnalyzer {
* - standard input produced by the process under test - standard output - * - standard input produced by the process under test - standard output -
* exit code Note: the command line is printed by the ProcessTools * exit code Note: the command line is printed by the ProcessTools
*/ */
private void reportDiagnosticSummary() { private OutputAnalyzer reportDiagnosticSummary() {
String msg = " stdout: [" + stdout + "];\n" + " stderr: [" + stderr String msg = " stdout: [" + stdout + "];\n" + " stderr: [" + stderr
+ "]\n" + " exitValue = " + getExitValue() + "\n"; + "]\n" + " exitValue = " + getExitValue() + "\n";
System.err.println(msg); System.err.println(msg);
return this;
} }
/** /**
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册