Skip to content

Commit e7d21fc

Browse files
author
Matthew Donovan
committedDec 16, 2024
8346285: Update jarsigner compatibility test for change in default digest algorithm
Reviewed-by: weijun
1 parent cb92595 commit e7d21fc

File tree

1 file changed

+10
-3
lines changed

1 file changed

+10
-3
lines changed
 

‎test/jdk/sun/security/tools/jarsigner/compatibility/Compatibility.java

+10-3
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright (c) 2017, 2023, Oracle and/or its affiliates. All rights reserved.
2+
* Copyright (c) 2017, 2024, 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
@@ -67,6 +67,7 @@
6767
import java.util.stream.Collectors;
6868
import java.util.stream.IntStream;
6969

70+
import jdk.security.jarsigner.JarSigner;
7071
import jdk.test.lib.process.OutputAnalyzer;
7172
import jdk.test.lib.process.ProcessTools;
7273
import jdk.test.lib.util.JarUtils;
@@ -1430,7 +1431,9 @@ private SignItem digestAlgorithm(String digestAlgorithm) {
14301431
String expectedDigestAlg() {
14311432
return digestAlgorithm != null
14321433
? digestAlgorithm
1433-
: jdkInfo.majorVersion >= 20 ? "SHA-384" : "SHA-256";
1434+
: jdkInfo.majorVersion >= 20
1435+
? JarSigner.Builder.getDefaultDigestAlgorithm()
1436+
: "SHA-256";
14341437
}
14351438

14361439
private SignItem tsaDigestAlgorithm(String tsaDigestAlgorithm) {
@@ -1439,7 +1442,11 @@ private SignItem tsaDigestAlgorithm(String tsaDigestAlgorithm) {
14391442
}
14401443

14411444
String expectedTsaDigestAlg() {
1442-
return tsaDigestAlgorithm != null ? tsaDigestAlgorithm : "SHA-256";
1445+
return tsaDigestAlgorithm != null
1446+
? tsaDigestAlgorithm
1447+
: jdkInfo.majorVersion >= 20
1448+
? JarSigner.Builder.getDefaultDigestAlgorithm()
1449+
: "SHA-256";
14431450
}
14441451

14451452
private SignItem tsaIndex(int tsaIndex) {

1 commit comments

Comments
 (1)

openjdk-notifier[bot] commented on Dec 16, 2024

@openjdk-notifier[bot]
Please sign in to comment.