Class KemCtxOpener

java.lang.Object
zeroecho.sdk.guard.KemCtxOpener
All Implemented Interfaces:
AutoCloseable, RecipientOpener

public final class KemCtxOpener extends Object implements RecipientOpener
Reusable opener for KEM:<algorithm>:GCM-WRAP entries.

Each applicable recipient entry receives a fresh decapsulation context from the explicit session. A failed same-algorithm entry therefore cannot consume the opener state needed by a later legitimate entry.

  • Constructor Details

    • KemCtxOpener

      public KemCtxOpener(ZeroEchoSession session)
      Creates an opener that derives contexts through the explicit session.
      Parameters:
      session - runtime configuration used for context creation
      Throws:
      NullPointerException - if session is null
  • Method Details

    • tryOpen

      public byte[] tryOpen(String entryId, byte[] entryBlob, UnlockMaterial material) throws GeneralSecurityException, IOException
      Description copied from interface: RecipientOpener
      Tries to recover the content-encryption key from the supplied recipient entry.
      Specified by:
      tryOpen in interface RecipientOpener
      Parameters:
      entryId - identifier string written by the sender; may be empty when labels are suppressed; used only as a routing hint
      entryBlob - opaque bytes of the recipient entry produced by the matching Recipient; never null
      material - unlocking material to use (for example, a private key or a password); never null
      Returns:
      a newly allocated byte array containing the recovered CEK, or null if this opener is not applicable
      Throws:
      GeneralSecurityException - if the entry appears applicable but cryptographic verification or unwrapping fails
      IOException - if parsing the entry blob fails due to structural errors or truncated data