Interface KeyRatchet

All Superinterfaces:
AutoCloseable

public interface KeyRatchet extends AutoCloseable
Represents a key ratchet, which manages the sequence of encryption/decryption keys for a sender.

In MLS, keys are "ratcheted" forward to ensure forward secrecy. This class holds the native handle to the ratchet state.

  • Method Summary

    Modifier and Type
    Method
    Description
    void
     
    void
    deleteKey(int keyGeneration)
    Deletes the key for a key generation, so it can no longer be derived from this ratchet.
    byte[]
    getEncryptionKey(int keyGeneration)
    Derives the encryption key for a key generation.
  • Method Details

    • getEncryptionKey

      byte[] getEncryptionKey(int keyGeneration)
      Derives the encryption key for a key generation.
      Parameters:
      keyGeneration - The key generation.
      Returns:
      The key bytes, or an empty array if the key could not be derived (for example after it was deleted).
    • deleteKey

      void deleteKey(int keyGeneration)
      Deletes the key for a key generation, so it can no longer be derived from this ratchet.
      Parameters:
      keyGeneration - The key generation.
    • close

      void close()
      Specified by:
      close in interface AutoCloseable