From 6f42b81417a762a651f0a65ed0f513cc75660673 Mon Sep 17 00:00:00 2001 From: Philip Helger Date: Sun, 10 Nov 2024 21:57:06 +0100 Subject: [PATCH] Improved APIs --- README.md | 3 + .../peppol/servicedomain/EPeppolNetwork.java | 112 ++++++++++++++++++ .../servicedomain/EPeppolServiceDomain.java | 48 +++++--- .../helger/peppol/utils/PeppolCAChecker.java | 21 ++-- .../utils/PeppolCertificateChecker.java | 30 ++--- .../peppol/utils/PeppolCertificateHelper.java | 1 + ...e.java => RevocationCheckResultCache.java} | 19 +-- .../utils/PeppolCertificateCheckerTest.java | 34 +++--- .../utils/PeppolCertificateHelperTest.java | 2 +- .../peppol/SMPClientReadOnlyTest.java | 2 +- 10 files changed, 200 insertions(+), 72 deletions(-) create mode 100644 peppol-commons/src/main/java/com/helger/peppol/servicedomain/EPeppolNetwork.java rename peppol-commons/src/main/java/com/helger/peppol/utils/{PeppolRevocationCache.java => RevocationCheckResultCache.java} (79%) diff --git a/README.md b/README.md index c646f212..5f34399a 100644 --- a/README.md +++ b/README.md @@ -315,6 +315,9 @@ They depend on several other libraries so I suggest you are going for the Maven * Made class `RevocationCheckBuilder` a top-level class * Totally reworked class `PeppolCertificateChecker` to add flexibility and support multiple Peppol CAs * Added new class `PeppolCAChecker` to support in the verification of Peppol certificates + * Renamed class `PeppolRevocationCache` to `RevocationCheckResultCache` + * Added new enum `EPeppolServiceDomain` to be able to provide specific settings for specific service domains + * Added new enum `EPeppolNetwork` to be able to easily different the different Peppol Network stages * v9.5.1 - 2024-08-11 * Make sure that wildcard lookups including a "*" in the Customization ID will always fail * Added additional `SMPClientReadOnly.getWildcardServiceMetadataOrNull` overload diff --git a/peppol-commons/src/main/java/com/helger/peppol/servicedomain/EPeppolNetwork.java b/peppol-commons/src/main/java/com/helger/peppol/servicedomain/EPeppolNetwork.java new file mode 100644 index 00000000..52314ca8 --- /dev/null +++ b/peppol-commons/src/main/java/com/helger/peppol/servicedomain/EPeppolNetwork.java @@ -0,0 +1,112 @@ +/* + * Copyright (C) 2015-2024 Philip Helger + * philip[at]helger[dot]com + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package com.helger.peppol.servicedomain; + +import javax.annotation.Nonnull; +import javax.annotation.Nullable; + +import com.helger.commons.annotation.Nonempty; +import com.helger.commons.id.IHasID; +import com.helger.commons.lang.EnumHelper; +import com.helger.commons.name.IHasDisplayName; +import com.helger.peppol.sml.ESML; +import com.helger.peppol.sml.ISMLInfo; + +/** + * This enum lists all the Peppol Network stages + * + * @author Philip Helger + * @since 9.6.0 + */ +public enum EPeppolNetwork implements IHasID , IHasDisplayName +{ + /** + * Peppol Test Network + */ + TEST ("test", "Peppol Test Network", "https://test-directory.peppol.eu", ESML.DIGIT_TEST), + /** + * Peppol Production Network + */ + PRODUCTION ("prod", "Peppol Production Network", "https://test-directory.peppol.eu", ESML.DIGIT_PRODUCTION); + + private final String m_sID; + private final String m_sDisplayName; + private final String m_sDirectoryURL; + private final ISMLInfo m_aSMLInfo; + + EPeppolNetwork (@Nonnull @Nonempty final String sID, + @Nonnull @Nonempty final String sDisplayName, + @Nonnull @Nonempty final String sDirectoryURL, + @Nonnull final ISMLInfo aSMLInfo) + { + m_sID = sID; + m_sDisplayName = sDisplayName; + m_sDirectoryURL = sDirectoryURL; + m_aSMLInfo = aSMLInfo; + } + + @Nonnull + @Nonempty + public String getID () + { + return m_sID; + } + + @Nonnull + @Nonempty + public String getDisplayName () + { + return m_sDisplayName; + } + + /** + * @return The URL of the Peppol Directory for this network stage. Never + * null. + */ + @Nonnull + @Nonempty + public String getDirectoryURL () + { + return m_sDirectoryURL; + } + + /** + * @return The SML object to be used for this network stage. Never + * null. + */ + @Nonnull + public ISMLInfo getSMLInfo () + { + return m_aSMLInfo; + } + + public boolean isProduction () + { + return this == PRODUCTION; + } + + public boolean isTest () + { + return this == TEST; + } + + @Nullable + public static EPeppolNetwork getFromIDOrNull (@Nullable final String sID) + { + return EnumHelper.getFromIDOrNull (EPeppolNetwork.class, sID); + } +} diff --git a/peppol-commons/src/main/java/com/helger/peppol/servicedomain/EPeppolServiceDomain.java b/peppol-commons/src/main/java/com/helger/peppol/servicedomain/EPeppolServiceDomain.java index a42fa6da..b10e6af8 100644 --- a/peppol-commons/src/main/java/com/helger/peppol/servicedomain/EPeppolServiceDomain.java +++ b/peppol-commons/src/main/java/com/helger/peppol/servicedomain/EPeppolServiceDomain.java @@ -38,43 +38,43 @@ public enum EPeppolServiceDomain implements IHasID * Managed by PoAC */ POST_AWARD ("post-award", - PeppolCertificateChecker.peppolPilotAP (), + PeppolCertificateChecker.peppolTestAP (), PeppolCertificateChecker.peppolProductionAP (), - PeppolCertificateChecker.peppolPilotSMP (), + PeppolCertificateChecker.peppolTestSMP (), PeppolCertificateChecker.peppolProductionSMP ()), /** * Managed by PrAC */ PRE_AWARD ("pre-award", - PeppolCertificateChecker.peppolPilotAP (), + PeppolCertificateChecker.peppolTestAP (), PeppolCertificateChecker.peppolProductionAP (), - PeppolCertificateChecker.peppolPilotSMP (), + PeppolCertificateChecker.peppolTestSMP (), PeppolCertificateChecker.peppolProductionSMP ()), /** * Enhanced B2B for Peppol-GENA bridge */ ENHANCED_B2B ("eb2b", - PeppolCertificateChecker.peppolPilotEb2bAP (), + PeppolCertificateChecker.peppolTestEb2bAP (), null, - PeppolCertificateChecker.peppolPilotSMP (), + PeppolCertificateChecker.peppolTestSMP (), null); private final String m_sID; - private final PeppolCAChecker m_aPilotAPChecker; + private final PeppolCAChecker m_aTestAPChecker; private final PeppolCAChecker m_aProdAPChecker; - private final PeppolCAChecker m_aPilotSMPChecker; + private final PeppolCAChecker m_aTestSMPChecker; private final PeppolCAChecker m_aProdSMPChecker; EPeppolServiceDomain (@Nonnull @Nonempty final String sID, - @Nullable final PeppolCAChecker aPilotAPChecker, + @Nullable final PeppolCAChecker aTestAPChecker, @Nullable final PeppolCAChecker aProdAPChecker, - @Nullable final PeppolCAChecker aPilotSMPChecker, + @Nullable final PeppolCAChecker aTestSMPChecker, @Nullable final PeppolCAChecker aProdSMPChecker) { m_sID = sID; - m_aPilotAPChecker = aPilotAPChecker; + m_aTestAPChecker = aTestAPChecker; m_aProdAPChecker = aProdAPChecker; - m_aPilotSMPChecker = aPilotSMPChecker; + m_aTestSMPChecker = aTestSMPChecker; m_aProdSMPChecker = aProdSMPChecker; } @@ -86,29 +86,41 @@ public String getID () } @Nullable - public final PeppolCAChecker getPilotAPChecker () + public PeppolCAChecker getTestAPChecker () { - return m_aPilotAPChecker; + return m_aTestAPChecker; } @Nullable - public final PeppolCAChecker getProdAPChecker () + public PeppolCAChecker getProdAPChecker () { return m_aProdAPChecker; } @Nullable - public final PeppolCAChecker getPilotSMPChecker () + public PeppolCAChecker getAPChecker (@Nonnull final EPeppolNetwork eNetwork) { - return m_aPilotSMPChecker; + return eNetwork.isTest () ? m_aTestAPChecker : m_aProdAPChecker; } @Nullable - public final PeppolCAChecker getProdSMPChecker () + public PeppolCAChecker getTestSMPChecker () + { + return m_aTestSMPChecker; + } + + @Nullable + public PeppolCAChecker getProdSMPChecker () { return m_aProdSMPChecker; } + @Nullable + public PeppolCAChecker getSMPChecker (@Nonnull final EPeppolNetwork eNetwork) + { + return eNetwork.isTest () ? m_aTestSMPChecker : m_aProdSMPChecker; + } + @Nullable public static EPeppolServiceDomain getFromIDOrNull (@Nullable final String sID) { diff --git a/peppol-commons/src/main/java/com/helger/peppol/utils/PeppolCAChecker.java b/peppol-commons/src/main/java/com/helger/peppol/utils/PeppolCAChecker.java index 1b6f437d..916e0354 100644 --- a/peppol-commons/src/main/java/com/helger/peppol/utils/PeppolCAChecker.java +++ b/peppol-commons/src/main/java/com/helger/peppol/utils/PeppolCAChecker.java @@ -24,14 +24,13 @@ import com.helger.commons.ValueEnforcer; import com.helger.commons.annotation.ReturnsMutableCopy; -import com.helger.commons.datetime.PDTFactory; import com.helger.commons.state.EChange; import com.helger.commons.state.ETriState; /** * This is a specific helper class to check the validity of Peppol certificates - * for a specific PA. See {@link PeppolCertificateChecker} for predefined - * instances of this class. + * for a specific CA. This class assumes the Peppol trust model. See + * {@link PeppolCertificateChecker} for predefined instances of this class. * * @author Philip Helger * @since 9.6.0 @@ -39,7 +38,7 @@ public final class PeppolCAChecker { private final TrustedCACertificates m_aTrustedCAs = new TrustedCACertificates (); - private final PeppolRevocationCache m_aRevocationCache; + private final RevocationCheckResultCache m_aRevocationCache; /** * Constructor @@ -54,11 +53,11 @@ public PeppolCAChecker (@Nonnull final X509Certificate... aCACerts) for (final X509Certificate aCACert : aCACerts) m_aTrustedCAs.addTrustedCACertificate (aCACert); // The cache always uses "now" as the checking date and time - m_aRevocationCache = new PeppolRevocationCache (aCert -> new RevocationCheckBuilder ().certificate (aCert) - .validCAs (aCACerts) - .checkMode (CertificateRevocationCheckerDefaults.getRevocationCheckMode ()) - .build (), - CertificateRevocationCheckerDefaults.DEFAULT_REVOCATION_CHECK_CACHING_DURATION); + m_aRevocationCache = new RevocationCheckResultCache (aCert -> new RevocationCheckBuilder ().certificate (aCert) + .validCAs (aCACerts) + .checkMode (CertificateRevocationCheckerDefaults.getRevocationCheckMode ()) + .build (), + CertificateRevocationCheckerDefaults.DEFAULT_REVOCATION_CHECK_CACHING_DURATION); } /** @@ -77,7 +76,7 @@ public TrustedCACertificates getAllTrustedAPCertificates () * null. */ @Nonnull - public PeppolRevocationCache getRevocationCache () + public RevocationCheckResultCache getRevocationCache () { return m_aRevocationCache; } @@ -104,7 +103,7 @@ public EChange clearRevocationCache () @Nonnull public EPeppolCertificateCheckResult checkCertificate (@Nullable final X509Certificate aCert) { - return checkCertificate (aCert, PDTFactory.getCurrentOffsetDateTime ()); + return checkCertificate (aCert, null); } /** diff --git a/peppol-commons/src/main/java/com/helger/peppol/utils/PeppolCertificateChecker.java b/peppol-commons/src/main/java/com/helger/peppol/utils/PeppolCertificateChecker.java index 3fe476e0..87bfe507 100644 --- a/peppol-commons/src/main/java/com/helger/peppol/utils/PeppolCertificateChecker.java +++ b/peppol-commons/src/main/java/com/helger/peppol/utils/PeppolCertificateChecker.java @@ -53,17 +53,17 @@ public final class PeppolCertificateChecker private static final Logger LOGGER = LoggerFactory.getLogger (PeppolCertificateChecker.class); - private static final PeppolCAChecker PILOT_AP = new PeppolCAChecker (PeppolKeyStoreHelper.Config2018.CERTIFICATE_PILOT_AP); + private static final PeppolCAChecker TEST_AP = new PeppolCAChecker (PeppolKeyStoreHelper.Config2018.CERTIFICATE_PILOT_AP); private static final PeppolCAChecker PROD_AP = new PeppolCAChecker (PeppolKeyStoreHelper.Config2018.CERTIFICATE_PRODUCTION_AP); private static final PeppolCAChecker ALL_AP = new PeppolCAChecker (PeppolKeyStoreHelper.Config2018.CERTIFICATE_PILOT_AP, PeppolKeyStoreHelper.Config2018.CERTIFICATE_PRODUCTION_AP); - private static final PeppolCAChecker PILOT_SMP = new PeppolCAChecker (PeppolKeyStoreHelper.Config2018.CERTIFICATE_PILOT_SMP); + private static final PeppolCAChecker TEST_SMP = new PeppolCAChecker (PeppolKeyStoreHelper.Config2018.CERTIFICATE_PILOT_SMP); private static final PeppolCAChecker PROD_SMP = new PeppolCAChecker (PeppolKeyStoreHelper.Config2018.CERTIFICATE_PRODUCTION_SMP); private static final PeppolCAChecker ALL_SMP = new PeppolCAChecker (PeppolKeyStoreHelper.Config2018.CERTIFICATE_PILOT_SMP, PeppolKeyStoreHelper.Config2018.CERTIFICATE_PRODUCTION_SMP); - private static final PeppolCAChecker PILOT_EB2B_AP = new PeppolCAChecker (PeppolKeyStoreHelper.Config2018.CERTIFICATE_PILOT_EB2B_AP); + private static final PeppolCAChecker TEST_EB2B_AP = new PeppolCAChecker (PeppolKeyStoreHelper.Config2018.CERTIFICATE_PILOT_EB2B_AP); private PeppolCertificateChecker () {} @@ -73,9 +73,9 @@ private PeppolCertificateChecker () * @since 9.6.0 */ @Nonnull - public static PeppolCAChecker peppolPilotAP () + public static PeppolCAChecker peppolTestAP () { - return PILOT_AP; + return TEST_AP; } /** @@ -103,9 +103,9 @@ public static PeppolCAChecker peppolAllAP () * @since 9.6.0 */ @Nonnull - public static PeppolCAChecker peppolPilotSMP () + public static PeppolCAChecker peppolTestSMP () { - return PILOT_SMP; + return TEST_SMP; } /** @@ -133,9 +133,9 @@ public static PeppolCAChecker peppolAllSMP () * @since 9.6.0 */ @Nonnull - public static PeppolCAChecker peppolPilotEb2bAP () + public static PeppolCAChecker peppolTestEb2bAP () { - return PILOT_EB2B_AP; + return TEST_EB2B_AP; } /** @@ -184,15 +184,15 @@ public static void clearOCSPCache () */ public static void clearRevocationCheckCache () { - PILOT_AP.clearRevocationCache (); + TEST_AP.clearRevocationCache (); PROD_AP.clearRevocationCache (); ALL_AP.clearRevocationCache (); - PILOT_SMP.clearRevocationCache (); + TEST_SMP.clearRevocationCache (); PROD_SMP.clearRevocationCache (); ALL_SMP.clearRevocationCache (); - PILOT_EB2B_AP.clearRevocationCache (); + TEST_EB2B_AP.clearRevocationCache (); LOGGER.info ("The PeppolCertificateChecker revocation cache was cleared"); } @@ -231,7 +231,7 @@ public static RevocationCheckBuilder peppolRevocationCheck () */ @Nonnull public static EPeppolCertificateCheckResult checkCertificate (@Nullable final ICommonsSet aIssuers, - @Nullable final PeppolRevocationCache aRevocationCache, + @Nullable final RevocationCheckResultCache aRevocationCache, @Nonnull final AbstractRevocationCheckBuilder aRevocationChecker) { ValueEnforcer.notNull (aRevocationChecker, "RevocationChecker"); @@ -351,7 +351,7 @@ public static EPeppolCertificateCheckResult checkCertificate (@Nullable final IC * May be null to use the global flag from * {@link CertificateRevocationCheckerDefaults#getRevocationCheckMode()}. * @return {@link EPeppolCertificateCheckResult} and never null. - * @deprecated Use {@link #peppolAllAP()}, {@link #peppolPilotAP()} or + * @deprecated Use {@link #peppolAllAP()}, {@link #peppolTestAP()} or * {@link #peppolProductionAP()} with * {@link PeppolCAChecker#checkCertificate(X509Certificate, OffsetDateTime, ETriState, ERevocationCheckMode)} * instead @@ -383,7 +383,7 @@ public static EPeppolCertificateCheckResult checkPeppolAPCertificate (@Nullable * May be null to use the global flag from * {@link CertificateRevocationCheckerDefaults#getRevocationCheckMode()}. * @return {@link EPeppolCertificateCheckResult} and never null. - * @deprecated Use {@link #peppolAllSMP()}, {@link #peppolPilotSMP()} or + * @deprecated Use {@link #peppolAllSMP()}, {@link #peppolTestSMP()} or * {@link #peppolProductionSMP()} with * {@link PeppolCAChecker#checkCertificate(X509Certificate, OffsetDateTime, ETriState, ERevocationCheckMode)} * instead diff --git a/peppol-commons/src/main/java/com/helger/peppol/utils/PeppolCertificateHelper.java b/peppol-commons/src/main/java/com/helger/peppol/utils/PeppolCertificateHelper.java index cbbeb2fa..b0864d0d 100644 --- a/peppol-commons/src/main/java/com/helger/peppol/utils/PeppolCertificateHelper.java +++ b/peppol-commons/src/main/java/com/helger/peppol/utils/PeppolCertificateHelper.java @@ -41,6 +41,7 @@ public final class PeppolCertificateHelper { public static final String PRINCIPAL_TYPE_CN = "CN"; + public static final String PRINCIPAL_TYPE_O = "O"; private PeppolCertificateHelper () {} diff --git a/peppol-commons/src/main/java/com/helger/peppol/utils/PeppolRevocationCache.java b/peppol-commons/src/main/java/com/helger/peppol/utils/RevocationCheckResultCache.java similarity index 79% rename from peppol-commons/src/main/java/com/helger/peppol/utils/PeppolRevocationCache.java rename to peppol-commons/src/main/java/com/helger/peppol/utils/RevocationCheckResultCache.java index 367ae43c..4793aceb 100644 --- a/peppol-commons/src/main/java/com/helger/peppol/utils/PeppolRevocationCache.java +++ b/peppol-commons/src/main/java/com/helger/peppol/utils/RevocationCheckResultCache.java @@ -36,12 +36,13 @@ * @author Philip Helger */ @ThreadSafe -public final class PeppolRevocationCache extends MappedCache > +public final class RevocationCheckResultCache extends MappedCache > { @Deprecated (forRemoval = true, since = "9.6.0") public static final Duration DEFAULT_CACHING_DURATION = CertificateRevocationCheckerDefaults.DEFAULT_REVOCATION_CHECK_CACHING_DURATION; + public static final int DEFAULT_MAX_SIZE = 1_000; - private static final Logger LOGGER = LoggerFactory.getLogger (PeppolRevocationCache.class); + private static final Logger LOGGER = LoggerFactory.getLogger (RevocationCheckResultCache.class); private final Function m_aRevocationChecker; private final Duration m_aCachingDuration; @@ -52,17 +53,17 @@ private static String _getKey (@Nonnull final X509Certificate aCert) return aCert.getSubjectX500Principal ().getName () + "-" + aCert.getSerialNumber ().toString (); } - public PeppolRevocationCache (@Nonnull final Function aRevocationChecker, - @Nonnull final Duration aCachingDuration) + public RevocationCheckResultCache (@Nonnull final Function aRevocationChecker, + @Nonnull final Duration aCachingDuration) { - this (aRevocationChecker, aCachingDuration, 1_000); + this (aRevocationChecker, aCachingDuration, DEFAULT_MAX_SIZE); } - public PeppolRevocationCache (@Nonnull final Function aRevocationChecker, - @Nonnull final Duration aCachingDuration, - final int nMaxSize) + public RevocationCheckResultCache (@Nonnull final Function aRevocationChecker, + @Nonnull final Duration aCachingDuration, + final int nMaxSize) { - super (PeppolRevocationCache::_getKey, cert -> { + super (RevocationCheckResultCache::_getKey, cert -> { final ERevoked eRevoked = aRevocationChecker.apply (cert); return ExpiringObject.ofDuration (eRevoked, aCachingDuration); }, nMaxSize, "CertificateRevocationCache", false); diff --git a/peppol-commons/src/test/java/com/helger/peppol/utils/PeppolCertificateCheckerTest.java b/peppol-commons/src/test/java/com/helger/peppol/utils/PeppolCertificateCheckerTest.java index 02042062..7ccea7f0 100644 --- a/peppol-commons/src/test/java/com/helger/peppol/utils/PeppolCertificateCheckerTest.java +++ b/peppol-commons/src/test/java/com/helger/peppol/utils/PeppolCertificateCheckerTest.java @@ -45,22 +45,22 @@ public class PeppolCertificateCheckerTest @Test public void testBasic () { - EPeppolCertificateCheckResult e = PeppolCertificateChecker.peppolPilotAP ().checkCertificate (null, null); + EPeppolCertificateCheckResult e = PeppolCertificateChecker.peppolTestAP ().checkCertificate (null); assertEquals (EPeppolCertificateCheckResult.NO_CERTIFICATE_PROVIDED, e); - e = PeppolCertificateChecker.peppolPilotAP () + e = PeppolCertificateChecker.peppolTestAP () .checkCertificate (PeppolKeyStoreHelper.Config2018.CERTIFICATE_PILOT_AP, PDTFactory.createOffsetDateTime (2000, Month.JANUARY, 1)); assertEquals (EPeppolCertificateCheckResult.NOT_YET_VALID, e); - e = PeppolCertificateChecker.peppolPilotAP () + e = PeppolCertificateChecker.peppolTestAP () .checkCertificate (PeppolKeyStoreHelper.Config2018.CERTIFICATE_PILOT_AP, PDTFactory.createOffsetDateTime (2099, Month.JANUARY, 1)); assertEquals (EPeppolCertificateCheckResult.EXPIRED, e); // It's the same certificate, but we need one issued by the pilot AP - e = PeppolCertificateChecker.peppolPilotAP () - .checkCertificate (PeppolKeyStoreHelper.Config2018.CERTIFICATE_PILOT_AP, null); + e = PeppolCertificateChecker.peppolTestAP () + .checkCertificate (PeppolKeyStoreHelper.Config2018.CERTIFICATE_PILOT_AP); assertEquals (EPeppolCertificateCheckResult.UNSUPPORTED_ISSUER, e); } @@ -86,7 +86,7 @@ public void testRealAPCert () throws Exception EPeppolCertificateCheckResult e; LOGGER.info ("Checking with OCSP_BEFORE_CRL"); - e = PeppolCertificateChecker.peppolPilotAP () + e = PeppolCertificateChecker.peppolTestAP () .checkCertificate (aCert, null, ETriState.FALSE, @@ -94,12 +94,12 @@ public void testRealAPCert () throws Exception assertEquals (EPeppolCertificateCheckResult.VALID, e); LOGGER.info ("Checking with OCSP"); - e = PeppolCertificateChecker.peppolPilotAP () + e = PeppolCertificateChecker.peppolTestAP () .checkCertificate (aCert, null, ETriState.FALSE, ERevocationCheckMode.OCSP); assertEquals (EPeppolCertificateCheckResult.VALID, e); LOGGER.info ("Checking with CRL_BEFORE_OCSP"); - e = PeppolCertificateChecker.peppolPilotAP () + e = PeppolCertificateChecker.peppolTestAP () .checkCertificate (aCert, null, ETriState.FALSE, @@ -107,18 +107,18 @@ public void testRealAPCert () throws Exception assertEquals (EPeppolCertificateCheckResult.VALID, e); LOGGER.info ("Checking with CRL"); - e = PeppolCertificateChecker.peppolPilotAP () + e = PeppolCertificateChecker.peppolTestAP () .checkCertificate (aCert, null, ETriState.FALSE, ERevocationCheckMode.CRL); assertEquals (EPeppolCertificateCheckResult.VALID, e); // Try again with CRL only to ensure it's not downloaded again LOGGER.info ("Checking with CRL"); - e = PeppolCertificateChecker.peppolPilotAP () + e = PeppolCertificateChecker.peppolTestAP () .checkCertificate (aCert, null, ETriState.FALSE, ERevocationCheckMode.CRL); assertEquals (EPeppolCertificateCheckResult.VALID, e); LOGGER.info ("Checking with NONE"); - e = PeppolCertificateChecker.peppolPilotAP () + e = PeppolCertificateChecker.peppolTestAP () .checkCertificate (aCert, null, ETriState.FALSE, ERevocationCheckMode.NONE); assertEquals (EPeppolCertificateCheckResult.VALID, e); } @@ -148,7 +148,7 @@ public void testRealSMPCert () throws Exception EPeppolCertificateCheckResult e; LOGGER.info ("Checking with OCSP_BEFORE_CRL"); - e = PeppolCertificateChecker.peppolPilotSMP () + e = PeppolCertificateChecker.peppolTestSMP () .checkCertificate (aCert, null, ETriState.FALSE, @@ -156,12 +156,12 @@ public void testRealSMPCert () throws Exception assertEquals (EPeppolCertificateCheckResult.VALID, e); LOGGER.info ("Checking with OCSP"); - e = PeppolCertificateChecker.peppolPilotSMP () + e = PeppolCertificateChecker.peppolTestSMP () .checkCertificate (aCert, null, ETriState.FALSE, ERevocationCheckMode.OCSP); assertEquals (EPeppolCertificateCheckResult.VALID, e); LOGGER.info ("Checking with CRL_BEFORE_OCSP"); - e = PeppolCertificateChecker.peppolPilotSMP () + e = PeppolCertificateChecker.peppolTestSMP () .checkCertificate (aCert, null, ETriState.FALSE, @@ -169,18 +169,18 @@ public void testRealSMPCert () throws Exception assertEquals (EPeppolCertificateCheckResult.VALID, e); LOGGER.info ("Checking with CRL"); - e = PeppolCertificateChecker.peppolPilotSMP () + e = PeppolCertificateChecker.peppolTestSMP () .checkCertificate (aCert, null, ETriState.FALSE, ERevocationCheckMode.CRL); assertEquals (EPeppolCertificateCheckResult.VALID, e); // Try again with CRL only to ensure it's not downloaded again LOGGER.info ("Checking with CRL"); - e = PeppolCertificateChecker.peppolPilotSMP () + e = PeppolCertificateChecker.peppolTestSMP () .checkCertificate (aCert, null, ETriState.FALSE, ERevocationCheckMode.CRL); assertEquals (EPeppolCertificateCheckResult.VALID, e); LOGGER.info ("Checking with NONE"); - e = PeppolCertificateChecker.peppolPilotSMP () + e = PeppolCertificateChecker.peppolTestSMP () .checkCertificate (aCert, null, ETriState.FALSE, ERevocationCheckMode.NONE); assertEquals (EPeppolCertificateCheckResult.VALID, e); } diff --git a/peppol-commons/src/test/java/com/helger/peppol/utils/PeppolCertificateHelperTest.java b/peppol-commons/src/test/java/com/helger/peppol/utils/PeppolCertificateHelperTest.java index 1429ed43..828ec2cc 100644 --- a/peppol-commons/src/test/java/com/helger/peppol/utils/PeppolCertificateHelperTest.java +++ b/peppol-commons/src/test/java/com/helger/peppol/utils/PeppolCertificateHelperTest.java @@ -74,7 +74,7 @@ public void testCheckRevoked () throws CertificateException StandardCharsets.UTF_8)); assertNotNull (aCert); // Check at a specific date, as the certificate - final EPeppolCertificateCheckResult eCertCheckResult = PeppolCertificateChecker.peppolPilotAP () + final EPeppolCertificateCheckResult eCertCheckResult = PeppolCertificateChecker.peppolTestAP () .checkCertificate (aCert, PDTFactory.createOffsetDateTime (2024, Month.JANUARY, diff --git a/peppol-smp-client/src/test/java/com/helger/smpclient/peppol/SMPClientReadOnlyTest.java b/peppol-smp-client/src/test/java/com/helger/smpclient/peppol/SMPClientReadOnlyTest.java index ab10f94f..012f77f7 100644 --- a/peppol-smp-client/src/test/java/com/helger/smpclient/peppol/SMPClientReadOnlyTest.java +++ b/peppol-smp-client/src/test/java/com/helger/smpclient/peppol/SMPClientReadOnlyTest.java @@ -530,7 +530,7 @@ public void testReceiverHasRevokedAPCert () throws Exception assertNotNull (aAPCert); // Check at a specific date, as the certificate - final EPeppolCertificateCheckResult eCertCheckResult = PeppolCertificateChecker.peppolPilotAP () + final EPeppolCertificateCheckResult eCertCheckResult = PeppolCertificateChecker.peppolTestAP () .checkCertificate (aAPCert, PDTFactory.createOffsetDateTime (2024, Month.JUNE,