Class KeyId

java.lang.Object
com.yahoo.security.KeyId

public class KeyId extends Object
Represents a named key ID comprising an arbitrary (but length-limited) sequence of valid UTF-8 bytes.
Author:
vekterli
  • Field Details

    • MAX_KEY_ID_UTF8_LENGTH

      public static final int MAX_KEY_ID_UTF8_LENGTH
      See Also:
  • Method Details

    • ofBytes

      public static KeyId ofBytes(byte[] keyIdBytes)
      Construct a KeyId containing the given sequence of bytes.
      Parameters:
      keyIdBytes - array of valid UTF-8 bytes. May be zero-length, but not null. Note: to avoid accidental mutations, the key bytes are deep-copied.
      Returns:
      a new KeyId instance
    • ofString

      public static KeyId ofString(String keyId)
      Construct a KeyId containing the UTF-8 byte representation of the given string.
      Parameters:
      keyId - a string whose UTF-8 byte representation will be the key ID. May be zero-length but not null.
      Returns:
      a new KeyId instance
    • asBytes

      public byte[] asBytes()
      Returns:
      the raw backing byte array. Must therefore not be mutated.
    • asString

      public String asString()
    • equals

      public boolean equals(Object o)
      Overrides:
      equals in class Object
    • hashCode

      public int hashCode()
      Overrides:
      hashCode in class Object
    • toString

      public String toString()
      Overrides:
      toString in class Object