net.i2p.crypto

## Class HMAC256Generator.HMACKey

- java.lang.Object
- - net.i2p.crypto.HMAC256Generator.HMACKey

- All Implemented Interfaces:
    Serializable, Key, SecretKey, Destroyable
  Enclosing class:
    HMAC256Generator

      static final class HMAC256Generator.HMACKey
      extends Object
      implements SecretKey

  Performance-optimized SecretKey implementation for HMAC operations. This class provides an efficient SecretKey implementation that avoids unnecessary key data copying during construction for improved performance. Unlike standard SecretKeySpec, this implementation maintains a direct reference to the key data while maintaining compatibility with Mac operations.

  Implementation Note: getEncoded() returns a copy of the first 32 bytes because the Mac class requires this behavior for proper operation. The full key data may be longer than 32 bytes.

- - ### Field Summary

    - ### Fields inherited from interface javax.crypto.SecretKey

      `serialVersionUID`

  - ### Constructor Summary

    Constructors
    Constructor and Description
    `HMACKey(byte[] data)`

  - ### Method Summary

    All Methods Instance Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `String` | `getAlgorithm()`
    `byte[]` | `getEncoded()`
    `String` | `getFormat()`

    - ### Methods inherited from class java.lang.Object

      `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

    - ### Methods inherited from interface javax.security.auth.Destroyable

      `destroy, isDestroyed`

- - ### Constructor Detail

    - #### HMACKey

          public HMACKey(byte[] data)

  - ### Method Detail

    - #### getAlgorithm

          public String getAlgorithm()

      Specified by:
        `getAlgorithm` in interface `Key`

    - #### getEncoded

          public byte[] getEncoded()

      Specified by:
        `getEncoded` in interface `Key`

    - #### getFormat

          public String getFormat()

      Specified by:
        `getFormat` in interface `Key`