Class MIC

java.lang.Object
com.helger.as2lib.crypto.MIC
All Implemented Interfaces:
com.helger.commons.lang.ICloneable<MIC>

public class MIC extends Object implements com.helger.commons.lang.ICloneable<MIC>
The MIC (Message Integrity Check) value. Basically a hash value over the message.
Since:
4.4.0
Author:
Philip Helger
  • Constructor Details

  • Method Details

    • micBytes

      @Nonnull public byte[] micBytes()
      Returns:
      The mutual MIC bytes. Handle with care. Never null.
    • getDigestAlgorithm

      @Nonnull public ECryptoAlgorithmSign getDigestAlgorithm()
      Returns:
      The algorithm that was used to create the MIC. Never null.
    • getAsAS2String

      @Nonnull @Nonempty public String getAsAS2String()
      Returns:
      This is the Base64-encoded message digest of the specified algorithm. The exact layout must be <Base64EncodedMIC>, <MICAlgorithmID>
    • getClone

      @Nonnull @ReturnsMutableCopy public MIC getClone()
      Specified by:
      getClone in interface com.helger.commons.lang.ICloneable<MIC>
    • equals

      public boolean equals(Object o)
      Overrides:
      equals in class Object
    • hashCode

      public int hashCode()
      Overrides:
      hashCode in class Object
    • toString

      public String toString()
      Overrides:
      toString in class Object
    • parse

      @Nullable public static MIC parse(@Nullable String sMIC)
      Parse the provided String representation of the MIC into a MIC object. This is the reverse operation to getAsAS2String().
      Parameters:
      sMIC - The MIC string to parse. May be null.
      Returns:
      null if an empty string was provided.
      Throws:
      IllegalArgumentException - If the layout is invalid and either the bytes could not be Base64 decoded or if an invalid signing crypto algorithm was used.