Class AeadKeysetHandleFactory

java.lang.Object
com.helixframework.crypto.aead.AeadKeysetHandleFactory

public class AeadKeysetHandleFactory extends Object
Factory for creating keyset handles.
  • Method Summary

    Modifier and Type
    Method
    Description
    com.google.crypto.tink.KeysetHandle
    Generates a new KeysetHandle.
    com.google.crypto.tink.KeysetHandle
    fromBytes(byte[] keyBytes)
    Creates a KeysetHandle instance from the supplied bytes.
    com.google.crypto.tink.KeysetHandle
    fromJson(String keyJson)
    Creates a KeysetHandle instance from the supplied JSON string.
    Gets the singleton instance of this factory.
    byte[]
    toBytes(com.google.crypto.tink.KeysetHandle keysetHandle)
    Converts the supplied KeysetHandle to bytes.
    toJson(com.google.crypto.tink.KeysetHandle keysetHandle)
    Converts the supplied KeysetHandle to a JSON string.

    Methods inherited from class java.lang.Object

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

    • getInstance

      public static AeadKeysetHandleFactory getInstance()
      Gets the singleton instance of this factory.
      Returns:
      a AeadKeysetHandleFactory instance
    • create

      public com.google.crypto.tink.KeysetHandle create() throws GeneralSecurityException
      Generates a new KeysetHandle.
      Returns:
      a new keyset handle
      Throws:
      GeneralSecurityException - if the keyset handle cannot be generated
    • toJson

      public String toJson(com.google.crypto.tink.KeysetHandle keysetHandle) throws IOException
      Converts the supplied KeysetHandle to a JSON string.
      Parameters:
      keysetHandle - keyset handle
      Returns:
      a json string representation of the keyset handle
      Throws:
      IOException - if the keyset handle cannot be converted to json
    • toBytes

      public byte[] toBytes(com.google.crypto.tink.KeysetHandle keysetHandle) throws IOException
      Converts the supplied KeysetHandle to bytes.
      Parameters:
      keysetHandle - keyset handle
      Returns:
      a bytes representation of the keyset handle
      Throws:
      IOException - if the keyset handle cannot be converted to json
    • fromBytes

      public com.google.crypto.tink.KeysetHandle fromBytes(byte[] keyBytes) throws GeneralSecurityException, IOException
      Creates a KeysetHandle instance from the supplied bytes.
      Parameters:
      keyBytes - key bytes
      Returns:
      a KeysetHandle
      Throws:
      GeneralSecurityException - if the keyset handle cannot be created
      IOException - if there is an issue reading the bytes
    • fromJson

      public com.google.crypto.tink.KeysetHandle fromJson(String keyJson) throws GeneralSecurityException, IOException
      Creates a KeysetHandle instance from the supplied JSON string.
      Parameters:
      keyJson - key in JSON format
      Returns:
      a KeysetHandle
      Throws:
      GeneralSecurityException - if the keyset handle cannot be created
      IOException - if there is an issue reading the json