Class MacKeyTemplates


  • @Deprecated
    public final class MacKeyTemplates
    extends java.lang.Object
    Deprecated.
    Use PredefinedMacParameters instead.
    Pre-generated KeyTemplate for Mac.

    We recommend to avoid this class in order to keep dependencies small.

    • Using this class adds a dependency on protobuf. We hope that eventually it is possible to use Tink without a dependency on protobuf.
    • Using this class adds a dependency on classes for all involved key types.
    These dependencies all come from static class member variables, which are initialized when the class is loaded. This implies that static analysis and code minimization tools (such as proguard) cannot remove the usages either.

    Instead, we recommend to use KeysetHandle.generateEntryFromParametersName or KeysetHandle.generateEntryFromParameters.

    One can use these templates to generate new Keyset with KeysetHandle. To generate a new keyset that contains a single HmacKey, one can do:

    
     MacConfig.register();
     KeysetHandle handle = KeysetHandle.generateNew(MacKeyTemplates.HMAC_SHA256_128BITTAG);
     Mac mac = handle.getPrimitive(RegistryConfiguration.get(), Mac.class);
     
    Since:
    1.0.0
    • Field Summary

      Fields 
      Modifier and Type Field Description
      static com.google.crypto.tink.proto.KeyTemplate AES_CMAC
      Deprecated.
      A KeyTemplate that generates new instances of com.google.crypto.tink.proto.CmacKey with the following parameters: Key size: 32 bytes Tag size: 16 bytes OutputPrefixType: TINK
      static com.google.crypto.tink.proto.KeyTemplate HMAC_SHA256_128BITTAG
      Deprecated.
      A KeyTemplate that generates new instances of HmacKey with the following parameters: Key size: 32 bytes Tag size: 16 bytes Hash function: SHA256 OutputPrefixType: TINK
      static com.google.crypto.tink.proto.KeyTemplate HMAC_SHA256_256BITTAG
      Deprecated.
      A KeyTemplate that generates new instances of HmacKey with the following parameters: Key size: 32 bytes Tag size: 32 bytes Hash function: SHA256 OutputPrefixType: TINK
      static com.google.crypto.tink.proto.KeyTemplate HMAC_SHA512_256BITTAG
      Deprecated.
      A KeyTemplate that generates new instances of HmacKey with the following parameters: Key size: 64 bytes Tag size: 32 bytes Hash function: SHA512 OutputPrefixType: TINK
      static com.google.crypto.tink.proto.KeyTemplate HMAC_SHA512_512BITTAG
      Deprecated.
      A KeyTemplate that generates new instances of HmacKey with the following parameters: Key size: 64 bytes Tag size: 64 bytes Hash function: SHA512 OutputPrefixType: TINK
    • Method Summary

      All Methods Static Methods Concrete Methods Deprecated Methods 
      Modifier and Type Method Description
      static com.google.crypto.tink.proto.KeyTemplate createHmacKeyTemplate​(int keySize, int tagSize, com.google.crypto.tink.proto.HashType hashType)
      Deprecated.
       
      • Methods inherited from class java.lang.Object

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

      • HMAC_SHA256_128BITTAG

        public static final com.google.crypto.tink.proto.KeyTemplate HMAC_SHA256_128BITTAG
        Deprecated.
        A KeyTemplate that generates new instances of HmacKey with the following parameters:
        • Key size: 32 bytes
        • Tag size: 16 bytes
        • Hash function: SHA256
        • OutputPrefixType: TINK
      • HMAC_SHA256_256BITTAG

        public static final com.google.crypto.tink.proto.KeyTemplate HMAC_SHA256_256BITTAG
        Deprecated.
        A KeyTemplate that generates new instances of HmacKey with the following parameters:
        • Key size: 32 bytes
        • Tag size: 32 bytes
        • Hash function: SHA256
        • OutputPrefixType: TINK
      • HMAC_SHA512_256BITTAG

        public static final com.google.crypto.tink.proto.KeyTemplate HMAC_SHA512_256BITTAG
        Deprecated.
        A KeyTemplate that generates new instances of HmacKey with the following parameters:
        • Key size: 64 bytes
        • Tag size: 32 bytes
        • Hash function: SHA512
        • OutputPrefixType: TINK
      • HMAC_SHA512_512BITTAG

        public static final com.google.crypto.tink.proto.KeyTemplate HMAC_SHA512_512BITTAG
        Deprecated.
        A KeyTemplate that generates new instances of HmacKey with the following parameters:
        • Key size: 64 bytes
        • Tag size: 64 bytes
        • Hash function: SHA512
        • OutputPrefixType: TINK
      • AES_CMAC

        public static final com.google.crypto.tink.proto.KeyTemplate AES_CMAC
        Deprecated.
        A KeyTemplate that generates new instances of com.google.crypto.tink.proto.CmacKey with the following parameters:
        • Key size: 32 bytes
        • Tag size: 16 bytes
        • OutputPrefixType: TINK
    • Method Detail

      • createHmacKeyTemplate

        public static com.google.crypto.tink.proto.KeyTemplate createHmacKeyTemplate​(int keySize,
                                                                                     int tagSize,
                                                                                     com.google.crypto.tink.proto.HashType hashType)
        Deprecated.
        Returns:
        a KeyTemplate containing a HmacKeyFormat with some specified parameters.