Class EncCtxOpener
java.lang.Object
zeroecho.sdk.guard.EncCtxOpener
- All Implemented Interfaces:
AutoCloseable, RecipientOpener
Reusable opener for
CTX-ENC:<algorithm> entries.
Each applicable recipient entry receives a fresh decryption context from the explicit session. A failed same-algorithm entry therefore cannot consume the opener state needed by a later legitimate entry.
-
Constructor Summary
ConstructorsConstructorDescriptionEncCtxOpener(ZeroEchoSession session) Creates an opener that derives contexts through the explicit session. -
Method Summary
Modifier and TypeMethodDescriptionbyte[]tryOpen(String entryId, byte[] blob, UnlockMaterial material) Tries to recover the content-encryption key from the supplied recipient entry.Methods inherited from class Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface RecipientOpener
close
-
Constructor Details
-
EncCtxOpener
Creates an opener that derives contexts through the explicit session.- Parameters:
session- runtime configuration used for context creation- Throws:
NullPointerException- ifsessionisnull
-
-
Method Details
-
tryOpen
public byte[] tryOpen(String entryId, byte[] blob, UnlockMaterial material) throws IOException, GeneralSecurityException Description copied from interface:RecipientOpenerTries to recover the content-encryption key from the supplied recipient entry.- Specified by:
tryOpenin interfaceRecipientOpener- Parameters:
entryId- identifier string written by the sender; may be empty when labels are suppressed; used only as a routing hintblob- opaque bytes of the recipient entry produced by the matchingRecipient; never nullmaterial- 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
nullif this opener is not applicable - Throws:
IOException- if parsing the entry blob fails due to structural errors or truncated dataGeneralSecurityException- if the entry appears applicable but cryptographic verification or unwrapping fails
-