Skip to content

Commit 797242c

Browse files
authored
GitHub Actions: build with JDK21 (#679)
Drop build support for Java 8
1 parent 919e28a commit 797242c

File tree

4 files changed

+23
-62
lines changed

4 files changed

+23
-62
lines changed

.github/workflows/maven.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ jobs:
77
strategy:
88
matrix:
99
os: [ubuntu-latest, windows-latest, macOS-latest]
10-
jdk: [8, 11, 17]
10+
jdk: [11, 17, 21]
1111
include:
1212
# lengthy build steps should only be performed on linux with Java 17 (Sonarcloud analysis, deployment)
1313
- os: ubuntu-latest

accesscontroltool-bundle/src/test/java/biz/netcentric/cq/tools/actool/configmodel/pkcs/KeyTest.java

Lines changed: 17 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,8 @@
1414
import org.bouncycastle.pkcs.PKCSException;
1515
import org.junit.jupiter.api.BeforeEach;
1616
import org.junit.jupiter.api.Test;
17+
import org.junit.jupiter.api.condition.EnabledForJreRange;
18+
import org.junit.jupiter.api.condition.JRE;
1719

1820
import biz.netcentric.cq.tools.actool.configmodel.TestDecryptionService;
1921
import biz.netcentric.cq.tools.actool.crypto.DecryptionService;
@@ -65,8 +67,9 @@ public void testEncryptedPkcs8RsaKeyWithUnrelatedCertificate() throws IOExceptio
6567
}
6668

6769
@Test
68-
// https://bugs.openjdk.java.net/browse/JDK-8231581 (Java 11) or https://bugs.openjdk.java.net/browse/JDK-8076999 (Java 8)
69-
public void testEncryptedPkcs8Pbes2RsaKeyWithCertificateOnJCASDefault() throws IOException, GeneralSecurityException, OperatorCreationException, PKCSException {
70+
@EnabledForJreRange(max = JRE.JAVA_17)
71+
// https://bugs.openjdk.java.net/browse/JDK-8231581 (Java 11) or https://bugs.openjdk.java.net/browse/JDK-8076999 (Java 8) but works with Java 21 (https://bugs.openjdk.org/browse/JDK-8288050)
72+
public void testEncryptedPkcs8Pbes2RsaKeyWithCertificateOnJCASDefaultPriorJava21() throws IOException, GeneralSecurityException, OperatorCreationException, PKCSException {
7073
try (InputStream inputPkcs8 = this.getClass().getResourceAsStream("example5_rsa_pkcs8");
7174
InputStream inputPemCert = this.getClass().getResourceAsStream("example5_rsa.crt")) {
7275
String privateKey = IOUtils.toString(inputPkcs8, StandardCharsets.US_ASCII);
@@ -76,6 +79,18 @@ public void testEncryptedPkcs8Pbes2RsaKeyWithCertificateOnJCASDefault() throws I
7679
}
7780
}
7881

82+
@Test
83+
@EnabledForJreRange(min = JRE.JAVA_21)
84+
public void testEncryptedPkcs8Pbes2RsaKeyWithCertificateOnJCASDefaultJava21() throws IOException, GeneralSecurityException, OperatorCreationException, PKCSException {
85+
try (InputStream inputPkcs8 = this.getClass().getResourceAsStream("example5_rsa_pkcs8");
86+
InputStream inputPemCert = this.getClass().getResourceAsStream("example5_rsa.crt")) {
87+
String privateKey = IOUtils.toString(inputPkcs8, StandardCharsets.US_ASCII);
88+
String certificate = IOUtils.toString(inputPemCert, StandardCharsets.US_ASCII);
89+
Key key = Key.createFromPrivateKeyAndCertificate(descryptionService, privateKey, "{password}", certificate, privateKeyDecryptor);
90+
key.getKeyPair();
91+
}
92+
}
93+
7994
@Test
8095
public void testEncryptedPkcs8Pbes2RsaKeyWithCertificateAndBouncycastle() throws IOException, GeneralSecurityException, OperatorCreationException, PKCSException {
8196
privateKeyDecryptor = new BouncycastlePkcs8EncryptedPrivateKeyDecryptor();

docs/Configuration.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -179,7 +179,7 @@ AEMs Crypto Support provides a 128 bit AES encryption which is stronger than the
179179

180180
To encrypt an unencrypted PKCS#8 private key (in PEM format) you can use the command
181181
`openssl pkcs8 -topk8 -in <unencrypted-private-key-file> -out <encrypted-private-key-file>`. It will ask you for the password interactively.
182-
By default this will use the unsafe `PbeWithMD5AndDES-CBC` algorithm (with 56 bit key). You should consider using more secure algorithms with parameter `v2`, those are only supported with [Bouncy Castle][bouncycastle], though. For more details refer also to [RFC 8018](https://tools.ietf.org/html/rfc8018#appendix-B.2)
182+
By default this will use the unsafe `PbeWithMD5AndDES-CBC` algorithm (with 56 bit key). You should consider using more secure algorithms with parameter `v2`, those are only supported with [Bouncy Castle][bouncycastle] or [Java 21+](https://bugs.openjdk.org/browse/JDK-8288050), though. For more details refer also to [RFC 8018](https://tools.ietf.org/html/rfc8018#appendix-B.2)
183183

184184
### Install Bouncy Castle
185185

pom.xml

Lines changed: 4 additions & 58 deletions
Original file line numberDiff line numberDiff line change
@@ -84,9 +84,10 @@
8484
<slf4j.version>1.7.25</slf4j.version>
8585
<bnd.version>6.3.1</bnd.version>
8686
<bouncycastle.version>1.64</bouncycastle.version>
87-
<java.target.version>8</java.target.version>
87+
<!-- release sets API classpath, source and target, see https://docs.oracle.com/javase/9/tools/javac.htm#GUID-AEEC9F07-CB49-4E96-8BC7-BCC2C7F725C9__GUID-D343F6B4-3FDD-43A8-AD24-43DD70214471 and http://openjdk.java.net/jeps/247 -->
88+
<maven.compiler.release>8</maven.compiler.release>
8889
<mockito.version>4.8.0</mockito.version>
89-
<junit.version>5.9.0</junit.version>
90+
<junit.version>5.10.0</junit.version>
9091
</properties>
9192

9293
<modules>
@@ -296,11 +297,6 @@
296297
<password>${crx.password}</password>
297298
</configuration>
298299
</plugin>
299-
<plugin>
300-
<groupId>org.codehaus.mojo</groupId>
301-
<artifactId>animal-sniffer-maven-plugin</artifactId>
302-
<version>1.21</version>
303-
</plugin>
304300
<!-- for building content packages -->
305301
<plugin>
306302
<groupId>org.apache.jackrabbit</groupId>
@@ -457,10 +453,7 @@
457453
<version>3.6.1</version>
458454
</requireMavenVersion>
459455
<requireJavaVersion>
460-
<version>1.8.0</version>
461-
<message>Bnd requires Java 8
462-
(https://github.com/bndtools/bnd/wiki/Changes-in-4.0.0)
463-
</message>
456+
<version>${maven.compiler.release}</version>
464457
</requireJavaVersion>
465458
</rules>
466459
</configuration>
@@ -484,53 +477,6 @@
484477
</build>
485478

486479
<profiles>
487-
<profile>
488-
<id>jdk8</id>
489-
<activation>
490-
<jdk>1.8</jdk>
491-
</activation>
492-
<properties>
493-
<!-- this affects m-compiler-p and m-javadoc-p -->
494-
<maven.compiler.source>1.8</maven.compiler.source>
495-
<maven.compiler.target>1.8</maven.compiler.target>
496-
</properties>
497-
<build>
498-
<plugins>
499-
<plugin>
500-
<groupId>org.codehaus.mojo</groupId>
501-
<artifactId>animal-sniffer-maven-plugin</artifactId>
502-
<executions>
503-
<execution>
504-
<goals>
505-
<goal>check</goal>
506-
</goals>
507-
</execution>
508-
</executions>
509-
<configuration>
510-
<signature>
511-
<groupId>org.codehaus.mojo.signature</groupId>
512-
<artifactId>java18</artifactId>
513-
<version>1.0</version>
514-
</signature>
515-
</configuration>
516-
</plugin>
517-
</plugins>
518-
</build>
519-
</profile>
520-
<profile>
521-
<id>jdk9-or-higher</id>
522-
<activation>
523-
<!-- syntax according to http://maven.apache.org/enforcer/enforcer-rules/versionRanges.html -->
524-
<jdk>[9,)</jdk>
525-
</activation>
526-
<properties>
527-
<!--
528-
release sets API classpath, source and target, see
529-
https://docs.oracle.com/javase/9/tools/javac.htm#GUID-AEEC9F07-CB49-4E96-8BC7-BCC2C7F725C9__GUID-D343F6B4-3FDD-43A8-AD24-43DD70214471
530-
and http://openjdk.java.net/jeps/247 -->
531-
<maven.compiler.release>${java.target.version}</maven.compiler.release>
532-
</properties>
533-
</profile>
534480
<profile>
535481
<id>release</id>
536482
<build>

0 commit comments

Comments
 (0)