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
6767import java .util .stream .Collectors ;
6868import java .util .stream .IntStream ;
6969
70+ import jdk .security .jarsigner .JarSigner ;
7071import jdk .test .lib .process .OutputAnalyzer ;
7172import jdk .test .lib .process .ProcessTools ;
7273import 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 ) {
0 commit comments