Skip to content

Commit

Permalink
8346285: Update jarsigner compatibility test for change in default di…
Browse files Browse the repository at this point in the history
…gest algorithm

Reviewed-by: weijun
  • Loading branch information
Matthew Donovan committed Dec 16, 2024
1 parent cb92595 commit e7d21fc
Showing 1 changed file with 10 additions and 3 deletions.
Original file line number Diff line number Diff line change
@@ -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
Expand Down Expand Up @@ -67,6 +67,7 @@
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;
Expand Down Expand Up @@ -1430,7 +1431,9 @@ private SignItem digestAlgorithm(String digestAlgorithm) {
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) {
Expand All @@ -1439,7 +1442,11 @@ private SignItem tsaDigestAlgorithm(String tsaDigestAlgorithm) {
}

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) {
Expand Down

1 comment on commit e7d21fc

@openjdk-notifier
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please sign in to comment.