Class AS2Helper

java.lang.Object
com.helger.as2lib.util.AS2Helper

@Immutable public final class AS2Helper extends Object
  • Method Details

    • getCryptoHelper

      @Nonnull public static ICryptoHelper getCryptoHelper()
    • createMDNData

      public static void createMDNData(@Nonnull IAS2Session aSession, @Nonnull IMessageMDN aMdn, boolean bSignMDN, boolean bIncludeCertificateInSignedContent, @Nullable ECryptoAlgorithmSign eMICAlg, boolean bUseOldRFC3851MicAlgs, boolean bRemoveCmsAlgorithmProtect) throws Exception
      Create and fill the MDN parameter
      Parameters:
      aSession - Session to retrieve the certificate factory for signing
      aMdn - The MDN object to be filled
      bSignMDN - true to sign the MDN
      bIncludeCertificateInSignedContent - true if the passed certificate should be part of the signed content, false if the certificate should not be put in the content. E.g. for PEPPOL this must be true.
      eMICAlg - The MIC algorithm to be used. Must be present if bSignMDN is true.
      bUseOldRFC3851MicAlgs - true to use the old RFC 3851 MIC algorithm names (e.g. sha1), false to use the new RFC 5751 MIC algorithm names (e.g. sha-1).
      bRemoveCmsAlgorithmProtect - if true, the CMS attribute "AlgorithmProtect" will be removed. This is needed in compatibility with e.g. IBM Sterling. Default value should be false. Since 4.10.1. See Issue #137.
      Throws:
      Exception - In case something internally goes wrong
    • createMDN

      @Nonnull public static IMessageMDN createMDN(@Nonnull IAS2Session aSession, @Nonnull AS2Message aMsg, @Nonnull DispositionType aDisposition, @Nonnull String sText) throws Exception
      Create a new MDN
      Parameters:
      aSession - AS2 session to be used. May not be null.
      aMsg - The source AS2 message for which the MDN is to be created. May not be null.
      aDisposition - The disposition - either success or error. May not be null.
      sText - The text to be send. May not be null.
      Returns:
      The created MDN object which is already attached to the passed source AS2 message.
      Throws:
      Exception - In case of an error
    • parseMDN

      public static void parseMDN(@Nonnull IMessage aMsg, @Nullable X509Certificate aReceiverCert, boolean bUseCertificateInBodyPart, @Nullable Consumer<? super X509Certificate> aEffectiveCertificateConsumer, @Nonnull AS2ResourceHelper aResHelper) throws Exception
      Throws:
      Exception
    • getWithoutSpaces

      @Nonnull public static String getWithoutSpaces(@Nonnull String s)