Class MACUtils

java.lang.Object
org.alfresco.encryption.MACUtils

public class MACUtils extends Object
Provides support for generating and checking MACs (Message Authentication Codes) using Alfresco's secret keys.
Since:
4.0
  • Constructor Details

    • MACUtils

      public MACUtils()
      Default constructor for IOC
  • Method Details

    • setKeyProvider

      public void setKeyProvider(KeyProvider keyProvider)
    • setMacAlgorithm

      public void setMacAlgorithm(String macAlgorithm)
    • getMac

      protected Mac getMac(String keyAlias) throws Exception
      Throws:
      Exception
    • longToByteArray

      protected byte[] longToByteArray(long l) throws IOException
      Throws:
      IOException
    • generateMAC

      public byte[] generateMAC(String keyAlias, MACUtils.MACInput macInput)
    • validateMAC

      public boolean validateMAC(String keyAlias, byte[] expectedMAC, MACUtils.MACInput macInput)
      Compares the expectedMAC against the MAC generated from Assumes message has been decrypted
      Parameters:
      keyAlias - String
      expectedMAC - byte[]
      macInput - MACInput
      Returns:
      boolean