Interface KeyEncapsulationMethod.Server

Enclosing interface:
KeyEncapsulationMethod

public static interface KeyEncapsulationMethod.Server
Server-side KEM operations.
  • Method Summary

    Modifier and Type
    Method
    Description
    byte[]
    Retrieves the encapsulation of the secret.
    int
    Retrieves the required length of the KEM public key, in bytes.
    byte[]
    Retrieves the secret.
    byte[]
    init(byte[] publicKey)
    Initializes the KEM with a public key received from a client and prepares an encapsulated secret.
  • Method Details

    • getPublicKeyLength

      int getPublicKeyLength()
      Retrieves the required length of the KEM public key, in bytes.
      Returns:
      the length of the key
    • init

      byte[] init(byte[] publicKey)
      Initializes the KEM with a public key received from a client and prepares an encapsulated secret.
      Parameters:
      publicKey - data received from the client, expected to contain the public key at the start
      Returns:
      the remaining bytes of publicKey after the public key
      Throws:
      IllegalArgumentException - if publicKey does not have enough bytes for a valid public key
      NullPointerException - if publicKey == null
    • getSecret

      byte[] getSecret()
      Retrieves the secret.
      Returns:
      the secret, not encapsulated
    • getEncapsulation

      byte[] getEncapsulation()
      Retrieves the encapsulation of the secret.
      Returns:
      the encapsulation of the secret that may be sent to the client