Class KemContext.KemResult

java.lang.Object
zeroecho.core.context.KemContext.KemResult
Enclosing interface:
KemContext

public static final class KemContext.KemResult extends Object
Encapsulation result holding both ciphertext and shared secret.

The array references are final, but their contents are mutable. Construction and access do not copy either array: the producer and recipient share the same buffers. The recipient must arrange exclusive access and clear the shared secret after use; clearing it also changes this result. This object provides no synchronization or automatic destruction.

Since:
1.0
  • Constructor Details

    • KemResult

      public KemResult(byte[] ciphertext, byte[] sharedSecret)
      Retains the provided arrays without copying or validating them.
      Parameters:
      ciphertext - the encapsulation ciphertext to be transmitted
      sharedSecret - the derived shared secret (sensitive material)
  • Method Details

    • ciphertext

      public byte[] ciphertext()
      Returns the encapsulation ciphertext.
      Returns:
      the retained ciphertext array, not a defensive copy
    • sharedSecret

      public byte[] sharedSecret()
      Returns the derived shared secret.

      This material is sensitive and should be passed into a KDF and then cleared as soon as possible.

      Returns:
      the retained shared-secret array, not a defensive copy