Skip to content

Commit

Permalink
Version bump
Browse files Browse the repository at this point in the history
  • Loading branch information
phax committed Nov 27, 2024
1 parent 615f213 commit c6d84a5
Show file tree
Hide file tree
Showing 18 changed files with 97 additions and 75 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -71,11 +71,15 @@ public class MainCEFeInvoicingConnectivityTest

static
{
final LoadedKeyStore aLKS = KeyStoreHelper.loadKeyStore (EKeyStoreType.JKS, YOUR_ID + "keystore.jks", "test123");
final LoadedKeyStore aLKS = KeyStoreHelper.loadKeyStore (EKeyStoreType.JKS,
YOUR_ID + "keystore.jks",
"test123".toCharArray ());
if (aLKS.isFailure ())
throw new InitializationException ("KeyStore error: " + aLKS.getErrorText (Locale.US));

final LoadedKeyStore aLTS = KeyStoreHelper.loadKeyStore (EKeyStoreType.JKS, "gateway_truststore.jks", "test123");
final LoadedKeyStore aLTS = KeyStoreHelper.loadKeyStore (EKeyStoreType.JKS,
"gateway_truststore.jks",
"test123".toCharArray ());
if (aLTS.isFailure ())
throw new InitializationException ("TrustStore error: " + aLTS.getErrorText (Locale.US));

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@
import com.helger.peppolid.peppol.PeppolIdentifierHelper;
import com.helger.phase4.util.Phase4Exception;
import com.helger.smpclient.exception.SMPClientException;
import com.helger.smpclient.peppol.ISMPExtendedServiceMetadataProvider;
import com.helger.smpclient.peppol.ISMPServiceGroupProvider;
import com.helger.smpclient.peppol.ISMPServiceMetadataProvider;
import com.helger.smpclient.peppol.PeppolWildcardSelector;
Expand All @@ -63,13 +64,13 @@ public class AS4EndpointDetailProviderPeppol implements IAS4EndpointDetailProvid
private static final Logger LOGGER = LoggerFactory.getLogger (AS4EndpointDetailProviderPeppol.class);

private final ISMPServiceGroupProvider m_aServiceGroupProvider;
private final ISMPServiceMetadataProvider m_aServiceMetadataProvider;
private final ISMPExtendedServiceMetadataProvider m_aServiceMetadataProvider;
private PeppolWildcardSelector.EMode m_eWildcardSelectionMode = DEFAULT_WILDCARD_SELECTION_MODE;
private ISMPTransportProfile m_aTP = DEFAULT_TRANSPORT_PROFILE;
private EndpointType m_aEndpoint;

public AS4EndpointDetailProviderPeppol (@Nonnull final ISMPServiceGroupProvider aServiceGroupProvider,
@Nonnull final ISMPServiceMetadataProvider aServiceMetadataProvider)
@Nonnull final ISMPExtendedServiceMetadataProvider aServiceMetadataProvider)
{
ValueEnforcer.notNull (aServiceGroupProvider, "ServiceGroupProvider");
ValueEnforcer.notNull (aServiceMetadataProvider, "ServiceMetadataProvider");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -130,8 +130,7 @@ public final KeyStore getKeyStore ()
{
ret = m_aKeyStore = KeyStoreHelper.loadKeyStore (m_aCryptoProps.getKeyStoreType (),
m_aCryptoProps.getKeyStorePath (),
m_aCryptoProps.getKeyStorePassword ())
.getKeyStore ();
m_aCryptoProps.getKeyStorePasswordCharArray ()).getKeyStore ();
}
return ret;
}
Expand Down Expand Up @@ -169,7 +168,7 @@ public final KeyStore getTrustStore ()
{
ret = m_aTrustStore = KeyStoreHelper.loadKeyStore (m_aCryptoProps.getTrustStoreType (),
m_aCryptoProps.getTrustStorePath (),
m_aCryptoProps.getTrustStorePassword ())
m_aCryptoProps.getTrustStorePasswordCharArray ())
.getKeyStore ();
}
return ret;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -216,6 +216,13 @@ public String getKeyStorePassword ()
return _getProperty (KEYSTORE_PASSWORD);
}

@Nullable
public char [] getKeyStorePasswordCharArray ()
{
final String ret = getKeyStorePassword ();
return ret == null ? null : ret.toCharArray ();
}

@Nonnull
public final AS4CryptoProperties setKeyStorePassword (@Nullable final String sKeyStorePassword)
{
Expand Down Expand Up @@ -316,6 +323,13 @@ public String getTrustStorePassword ()
return _getProperty (TRUSTSTORE_PASSWORD);
}

@Nullable
public char [] getTrustStorePasswordCharArray ()
{
final String ret = getTrustStorePassword ();
return ret == null ? null : ret.toCharArray ();
}

@Nonnull
public final AS4CryptoProperties setTrustStorePassword (@Nullable final String sTrustStorePassword)
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,6 @@
import com.helger.peppol.sbdh.spec12.BinaryContentType;
import com.helger.peppol.sbdh.spec12.TextContentType;
import com.helger.peppol.sbdh.write.PeppolSBDHDocumentWriter;
import com.helger.peppol.utils.CertificateRevocationChecker;
import com.helger.peppol.utils.EPeppolCertificateCheckResult;
import com.helger.peppol.utils.ERevocationCheckMode;
import com.helger.peppol.utils.PeppolCertificateChecker;
Expand Down Expand Up @@ -343,10 +342,11 @@ private static void _checkReceiverAPCert (@Nullable final X509Certificate aRecei
LOGGER.debug ("Using the following receiver AP certificate from the SMP: " + aReceiverCert);

final OffsetDateTime aNow = MetaAS4Manager.getTimestampMgr ().getCurrentDateTime ();
final EPeppolCertificateCheckResult eCertCheckResult = PeppolCertificateChecker.checkPeppolAPCertificate (aReceiverCert,
aNow,
eCacheOSCResult,
eCheckMode);
final EPeppolCertificateCheckResult eCertCheckResult = PeppolCertificateChecker.peppolAllAP ()
.checkCertificate (aReceiverCert,
aNow,
eCacheOSCResult,
eCheckMode);

// Interested in the certificate?
if (aCertificateConsumer != null)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -75,12 +75,12 @@ public static void main (final String [] args)
// Expired Peppol AP certificate that was valid until 2021
final IAS4CryptoFactory cf = new AS4CryptoFactoryInMemoryKeyStore (KeyStoreHelper.loadKeyStoreDirect (EKeyStoreType.PKCS12,
"peppol-expired-ap-cert-pw-peppol.p12",
"peppol"),
"peppol".toCharArray ()),
"cert",
"peppol",
KeyStoreHelper.loadKeyStore (PeppolKeyStoreHelper.TRUSTSTORE_TYPE,
PeppolKeyStoreHelper.Config2018.TRUSTSTORE_AP_PILOT_CLASSPATH,
PeppolKeyStoreHelper.TRUSTSTORE_PASSWORD)
PeppolKeyStoreHelper.TRUSTSTORE_PASSWORD.toCharArray ())
.getKeyStore ());

final ESimpleUserMessageSendResult eResult;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -59,10 +59,14 @@ public static void main (final String [] args)

// Start configuring here
final IParticipantIdentifier aReceiverID = Phase4PeppolSender.IF.createParticipantIdentifierWithDefaultScheme ("9914:atu68241501");
final KeyStore aKS = KeyStoreHelper.loadKeyStoreDirect (EKeyStoreType.PKCS12, "test-ap.p12", "peppol");
final KeyStore aKS = KeyStoreHelper.loadKeyStoreDirect (EKeyStoreType.PKCS12,
"test-ap.p12",
"peppol".toCharArray ());
if (aKS == null)
throw new IllegalStateException ();
final KeyStore aTS = KeyStoreHelper.loadKeyStoreDirect (EKeyStoreType.JKS, "complete-truststore.jks", "peppol");
final KeyStore aTS = KeyStoreHelper.loadKeyStoreDirect (EKeyStoreType.JKS,
"complete-truststore.jks",
"peppol".toCharArray ());
if (aTS == null)
throw new IllegalStateException ();
final IAS4CryptoFactory aInMemoryCryptoFactory = new AS4CryptoFactoryInMemoryKeyStore (aKS,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -75,12 +75,12 @@ public static void main (final String [] args)
// Invalid certificate is valid until 2029
final IAS4CryptoFactory cf = new AS4CryptoFactoryInMemoryKeyStore (KeyStoreHelper.loadKeyStoreDirect (EKeyStoreType.JKS,
"invalid-keystore-pw-peppol.jks",
"peppol"),
"peppol".toCharArray ()),
"1",
"peppol",
KeyStoreHelper.loadKeyStore (PeppolKeyStoreHelper.TRUSTSTORE_TYPE,
PeppolKeyStoreHelper.Config2018.TRUSTSTORE_AP_PILOT_CLASSPATH,
PeppolKeyStoreHelper.TRUSTSTORE_PASSWORD)
PeppolKeyStoreHelper.TRUSTSTORE_PASSWORD.toCharArray ())
.getKeyStore ());

final ESimpleUserMessageSendResult eResult;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -104,12 +104,12 @@ public void onAS4Message (final AbstractAS4Message <?> aMsg)
final IAS4CryptoFactory cf = true ? AS4CryptoFactoryProperties.getDefaultInstance ()
: new AS4CryptoFactoryInMemoryKeyStore (KeyStoreHelper.loadKeyStoreDirect (EKeyStoreType.JKS,
"invalid-keystore-pw-peppol.jks",
"peppol"),
"peppol".toCharArray ()),
"1",
"peppol",
KeyStoreHelper.loadKeyStore (PeppolKeyStoreHelper.TRUSTSTORE_TYPE,
PeppolKeyStoreHelper.Config2018.TRUSTSTORE_AP_PRODUCTION_CLASSPATH,
PeppolKeyStoreHelper.TRUSTSTORE_PASSWORD)
PeppolKeyStoreHelper.TRUSTSTORE_PASSWORD.toCharArray ())
.getKeyStore ());
final ESimpleUserMessageSendResult eResult;
eResult = Phase4PeppolSender.builder ()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ public static void main (final String [] args)
ESML.DIGIT_TEST))
.rawResponseConsumer (new AS4RawResponseConsumerWriteToFile ())
.validationRegistry (aVESRegistry)
.validationConfiguration (EN16931Validation.VID_CII_1311,
.validationConfiguration (EN16931Validation.VID_CII_1313,
new Phase4PeppolValidatonResultHandler ())
.sendMessageAndCheckForReceipt ();
LOGGER.info ("Peppol send result: " + eResult);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -305,11 +305,12 @@ private static void _initPeppolAS4 ()
// if something is misconfigured
// * Do not cache result
// * Use the global checking mode or provide a new one
final EPeppolCertificateCheckResult eCheckResult = PeppolCertificateChecker.checkPeppolAPCertificate (aAPCert,
MetaAS4Manager.getTimestampMgr ()
.getCurrentDateTime (),
ETriState.FALSE,
null);
final EPeppolCertificateCheckResult eCheckResult = PeppolCertificateChecker.peppolAllAP ()
.checkCertificate (aAPCert,
MetaAS4Manager.getTimestampMgr ()
.getCurrentDateTime (),
ETriState.FALSE,
null);
if (eCheckResult.isInvalid ())
throw new InitializationException ("The provided certificate is not a valid Peppol AP certificate. Check result: " +
eCheckResult);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@
import com.helger.commons.ValueEnforcer;
import com.helger.commons.annotation.Nonempty;
import com.helger.commons.string.ToStringGenerator;
import com.helger.smpclient.peppol.ISMPServiceMetadataProvider;
import com.helger.smpclient.peppol.ISMPExtendedServiceMetadataProvider;
import com.helger.smpclient.peppol.PeppolWildcardSelector;

/**
Expand All @@ -39,7 +39,7 @@
public class Phase4PeppolReceiverCheckData
{
private final boolean m_bReceiverCheckEnabled;
private final ISMPServiceMetadataProvider m_aSMPClient;
private final ISMPExtendedServiceMetadataProvider m_aSMPClient;
private final PeppolWildcardSelector.EMode m_eWildcardSelectionMode;
private final String m_sAS4EndpointURL;
private final X509Certificate m_aAPCertificate;
Expand All @@ -63,7 +63,7 @@ public class Phase4PeppolReceiverCheckData
* <code>null</code>. Added in 2.7.3.
*/
@Deprecated (since = "2.8.1", forRemoval = true)
public Phase4PeppolReceiverCheckData (@Nonnull final ISMPServiceMetadataProvider aSMPClient,
public Phase4PeppolReceiverCheckData (@Nonnull final ISMPExtendedServiceMetadataProvider aSMPClient,
@Nonnull @Nonempty final String sAS4EndpointURL,
@Nonnull final X509Certificate aAPCertificate,
@Nonnull final PeppolWildcardSelector.EMode eWildcardSelectionMode)
Expand Down Expand Up @@ -107,7 +107,7 @@ public Phase4PeppolReceiverCheckData (@Nonnull final ISMPServiceMetadataProvider
* @since 2.8.1
*/
public Phase4PeppolReceiverCheckData (final boolean bReceiverCheckEnabled,
@Nullable final ISMPServiceMetadataProvider aSMPClient,
@Nullable final ISMPExtendedServiceMetadataProvider aSMPClient,
@Nonnull final PeppolWildcardSelector.EMode eWildcardSelectionMode,
@Nullable final String sAS4EndpointURL,
@Nullable final X509Certificate aAPCertificate,
Expand Down Expand Up @@ -145,7 +145,7 @@ public boolean isReceiverCheckEnabled ()
* @see #isReceiverCheckEnabled()
*/
@Nullable
public ISMPServiceMetadataProvider getSMPClient ()
public ISMPExtendedServiceMetadataProvider getSMPClient ()
{
return m_aSMPClient;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@
import com.helger.commons.string.StringHelper;
import com.helger.peppol.sbdh.read.PeppolSBDHDocumentReader;
import com.helger.phase4.CAS4;
import com.helger.smpclient.peppol.ISMPServiceMetadataProvider;
import com.helger.smpclient.peppol.ISMPExtendedServiceMetadataProvider;
import com.helger.smpclient.peppol.PeppolWildcardSelector;
import com.helger.smpclient.peppol.PeppolWildcardSelector.EMode;

Expand All @@ -54,7 +54,7 @@ public final class Phase4PeppolServletConfiguration
private static final Logger LOGGER = LoggerFactory.getLogger (Phase4PeppolServletConfiguration.class);

private static boolean s_bReceiverCheckEnabled = DEFAULT_RECEIVER_CHECK_ENABLED;
private static ISMPServiceMetadataProvider s_aSMPClient;
private static ISMPExtendedServiceMetadataProvider s_aSMPClient;
private static PeppolWildcardSelector.EMode s_eWildcardSelectionMode = DEFAULT_WILDCARD_SELECTION_MODE;
private static String s_sAS4EndpointURL;
private static X509Certificate s_aAPCertificate;
Expand Down Expand Up @@ -82,7 +82,7 @@ public static boolean isReceiverCheckEnabled ()
* @param bReceiverCheckEnabled
* <code>true</code> to enable the checks, <code>false</code> to
* disable them.
* @see #setSMPClient(ISMPServiceMetadataProvider)
* @see #setSMPClient(ISMPExtendedServiceMetadataProvider)
* @see #setWildcardSelectionMode(EMode)
* @see #setAS4EndpointURL(String)
* @see #setAPCertificate(X509Certificate)
Expand All @@ -99,7 +99,7 @@ public static void setReceiverCheckEnabled (final boolean bReceiverCheckEnabled)
* configured.
*/
@Nullable
public static ISMPServiceMetadataProvider getSMPClient ()
public static ISMPExtendedServiceMetadataProvider getSMPClient ()
{
return s_aSMPClient;
}
Expand All @@ -111,7 +111,7 @@ public static ISMPServiceMetadataProvider getSMPClient ()
* @param aSMPClient
* The SMP metadata provider to be used. May be <code>null</code>.
*/
public static void setSMPClient (@Nullable final ISMPServiceMetadataProvider aSMPClient)
public static void setSMPClient (@Nullable final ISMPExtendedServiceMetadataProvider aSMPClient)
{
s_aSMPClient = aSMPClient;
}
Expand Down Expand Up @@ -292,7 +292,7 @@ public static void setCheckSigningCertificateRevocation (final boolean b)
@Nonnull
public static Phase4PeppolReceiverCheckData getAsReceiverCheckData ()
{
final ISMPServiceMetadataProvider aSMPClient = getSMPClient ();
final ISMPExtendedServiceMetadataProvider aSMPClient = getSMPClient ();
final String sAS4EndpointURL = getAS4EndpointURL ();
final X509Certificate aAPCertificate = getAPCertificate ();

Expand Down
Loading

0 comments on commit c6d84a5

Please sign in to comment.