Class HMAC

    • Constructor Summary

      Constructors 
      Constructor Description
      HMAC()  
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      byte[] generateMAC​(byte[] key, byte[] data)
      MAC generation
      boolean verifyMAC​(byte[] key, byte[] mac, byte[] data)
      MAC verification
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • HMAC

        public HMAC()
    • Method Detail

      • generateMAC

        public byte[] generateMAC​(byte[] key,
                                  byte[] data)
                           throws java.lang.Exception
        Description copied from interface: MessageAuthenticationCodeAlgorithm
        MAC generation
        Specified by:
        generateMAC in interface MessageAuthenticationCodeAlgorithm
        Parameters:
        key - MAC secret key
        data - Data, which needed to be secure with MAC
        Returns:
        mac Message authentication code
        Throws:
        java.lang.Exception - MAC generation error
      • verifyMAC

        public boolean verifyMAC​(byte[] key,
                                 byte[] mac,
                                 byte[] data)
                          throws java.lang.Exception
        Description copied from interface: MessageAuthenticationCodeAlgorithm
        MAC verification
        Specified by:
        verifyMAC in interface MessageAuthenticationCodeAlgorithm
        Parameters:
        key - MAC secret key
        mac - Message authentication code
        data - Data to check
        Returns:
        result Check result
        Throws:
        java.lang.Exception - MAC check error