Class LegacyFullMac

  • All Implemented Interfaces:
    Mac

    public final class LegacyFullMac
    extends java.lang.Object
    implements Mac
    Takes an arbitrary raw Mac and makes it a full primitive. This is a class that helps us transition onto the new Keys and Configurations interface, by bringing potential user-defined primitives to a common denominator with our primitives over which we have control.
    • Method Summary

      All Methods Static Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      byte[] computeMac​(byte[] data)
      Computes message authentication code (MAC) for data.
      static Mac create​(LegacyProtoKey key)
      This method covers the cases where users created their own mac/key classes.
      void verifyMac​(byte[] mac, byte[] data)
      Verifies whether mac is a correct authentication code (MAC) for data.
      • Methods inherited from class java.lang.Object

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

      • create

        public static Mac create​(LegacyProtoKey key)
                          throws java.security.GeneralSecurityException
        This method covers the cases where users created their own mac/key classes.
        Throws:
        java.security.GeneralSecurityException
      • computeMac

        public byte[] computeMac​(byte[] data)
                          throws java.security.GeneralSecurityException
        Description copied from interface: Mac
        Computes message authentication code (MAC) for data.
        Specified by:
        computeMac in interface Mac
        Returns:
        MAC value
        Throws:
        java.security.GeneralSecurityException
      • verifyMac

        public void verifyMac​(byte[] mac,
                              byte[] data)
                       throws java.security.GeneralSecurityException
        Description copied from interface: Mac
        Verifies whether mac is a correct authentication code (MAC) for data.
        Specified by:
        verifyMac in interface Mac
        Throws:
        java.security.GeneralSecurityException - if mac is not a correct MAC for data