From b476b055f0b4e24ce6a3fb8f3deef6a9e0bb57c2 Mon Sep 17 00:00:00 2001 From: Rune Flobakk Date: Thu, 8 Jan 2026 15:51:29 +0100 Subject: [PATCH 1/2] Ensure only NOOP hostname verifier is used for TLS Because of Signering API using non-standard certificates for establishing TLS connection, i.e. enterprise certificates (virksomhetssertifikat). Apache Http Client changed behavior in v5.6, where it is not enough to configure your own HostnameVerifier. To avoid the verification which is built-in the JDK SSL stack, one must explicitly configure this policy to HostnameVerificationPolicy.CLIENT. https://lists.apache.org/thread/xycs1swxpdc4g3255ms0p1kshbl3ky29 (see "Compatibility notes") https://github.com/apache/httpcomponents-client/commit/d89fdfeb6f66a20aefac6b50375e30613b2fc08b --- lib/pom.xml | 8 ++++---- .../configuration/ApacheHttpClientSslConfigurer.java | 4 +++- 2 files changed, 7 insertions(+), 5 deletions(-) diff --git a/lib/pom.xml b/lib/pom.xml index 8e4bb98..66e30e2 100644 --- a/lib/pom.xml +++ b/lib/pom.xml @@ -28,7 +28,7 @@ org.junit junit-bom - 5.13.0-M2 + 5.14.2 pom import @@ -74,18 +74,18 @@ org.apache.httpcomponents.client5 httpclient5 - 5.4.4 + 5.6 org.apache.httpcomponents.core5 httpcore5 - 5.3.4 + 5.4 commons-io commons-io - 2.19.0 + 2.21.0 test diff --git a/lib/src/main/java/no/digipost/signature/client/core/internal/configuration/ApacheHttpClientSslConfigurer.java b/lib/src/main/java/no/digipost/signature/client/core/internal/configuration/ApacheHttpClientSslConfigurer.java index 02463bb..0122709 100644 --- a/lib/src/main/java/no/digipost/signature/client/core/internal/configuration/ApacheHttpClientSslConfigurer.java +++ b/lib/src/main/java/no/digipost/signature/client/core/internal/configuration/ApacheHttpClientSslConfigurer.java @@ -9,6 +9,7 @@ import no.digipost.signature.client.security.OrganizationNumberValidation; import org.apache.hc.client5.http.impl.io.PoolingHttpClientConnectionManagerBuilder; import org.apache.hc.client5.http.ssl.DefaultClientTlsStrategy; +import org.apache.hc.client5.http.ssl.HostnameVerificationPolicy; import org.apache.hc.client5.http.ssl.NoopHostnameVerifier; import org.apache.hc.core5.ssl.SSLContexts; @@ -40,7 +41,8 @@ public ApacheHttpClientSslConfigurer certificatChainValidation(CertificateChainV @Override public void applyTo(PoolingHttpClientConnectionManagerBuilder connectionManager) { - connectionManager.setTlsSocketStrategy(new DefaultClientTlsStrategy(sslContext(), NoopHostnameVerifier.INSTANCE)); + connectionManager.setTlsSocketStrategy( + new DefaultClientTlsStrategy(sslContext(), HostnameVerificationPolicy.CLIENT, NoopHostnameVerifier.INSTANCE)); } From de9f01f879914b5382a3142a7dce2d8a39f2f21e Mon Sep 17 00:00:00 2001 From: Rune Flobakk Date: Thu, 8 Jan 2026 16:15:11 +0100 Subject: [PATCH 2/2] Upgrade Maven plugins --- lib/pom.xml | 14 +++++++------- pom.xml | 6 +++--- 2 files changed, 10 insertions(+), 10 deletions(-) diff --git a/lib/pom.xml b/lib/pom.xml index 66e30e2..7ffb64f 100644 --- a/lib/pom.xml +++ b/lib/pom.xml @@ -183,12 +183,12 @@ maven-compiler-plugin - 3.14.0 + 3.14.1 com.github.siom79.japicmp japicmp-maven-plugin - 0.23.1 + 0.24.2 @@ -202,7 +202,7 @@ maven-shade-plugin - 3.6.0 + 3.6.1 true @@ -228,15 +228,15 @@ maven-surefire-plugin - 3.5.3 + 3.5.4 maven-resources-plugin - 3.3.1 + 3.4.0 maven-javadoc-plugin - 3.11.2 + 3.12.0 maven-jar-plugin @@ -244,7 +244,7 @@ maven-enforcer-plugin - 3.6.1 + 3.6.2 diff --git a/pom.xml b/pom.xml index 6950dc7..26e66c6 100644 --- a/pom.xml +++ b/pom.xml @@ -22,7 +22,7 @@ no.digipost digipost-open-super-pom - 14 + 15 no.digipost.signature @@ -68,7 +68,7 @@ maven-dependency-plugin - 3.8.1 + 3.9.0 maven-install-plugin @@ -77,7 +77,7 @@ org.codehaus.mojo versions-maven-plugin - 2.18.0 + 2.20.1