8346285: Update jarsigner compatibility test for change in default digest algorithm

Reviewed-by: weijun
This commit is contained in:
Matthew Donovan 2024-12-16 16:18:57 +00:00
parent cb92595599
commit e7d21fcf49

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 2017, 2023, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2017, 2024, 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
@ -67,6 +67,7 @@ import java.util.jar.Manifest;
import java.util.stream.Collectors;
import java.util.stream.IntStream;
import jdk.security.jarsigner.JarSigner;
import jdk.test.lib.process.OutputAnalyzer;
import jdk.test.lib.process.ProcessTools;
import jdk.test.lib.util.JarUtils;
@ -1430,7 +1431,9 @@ public class Compatibility {
String expectedDigestAlg() {
return digestAlgorithm != null
? digestAlgorithm
: jdkInfo.majorVersion >= 20 ? "SHA-384" : "SHA-256";
: jdkInfo.majorVersion >= 20
? JarSigner.Builder.getDefaultDigestAlgorithm()
: "SHA-256";
}
private SignItem tsaDigestAlgorithm(String tsaDigestAlgorithm) {
@ -1439,7 +1442,11 @@ public class Compatibility {
}
String expectedTsaDigestAlg() {
return tsaDigestAlgorithm != null ? tsaDigestAlgorithm : "SHA-256";
return tsaDigestAlgorithm != null
? tsaDigestAlgorithm
: jdkInfo.majorVersion >= 20
? JarSigner.Builder.getDefaultDigestAlgorithm()
: "SHA-256";
}
private SignItem tsaIndex(int tsaIndex) {