open method

Uint8List open({
  1. required Uint8List sessionKey,
  2. required Uint8List msgToOpen,
  3. required Uint8List msgToAuth,
  4. required Uint8List domain,
})

Consumes a standalone cryptographic construct encrypted to this secret key. The method will deconstruct the given encapsulated key and ciphertext and will also verify the authenticity of the (unencrypted) message-to-auth (not included in the ciphertext).

X-Wing is used in HPKE's base mode, which does not authenticate the sender, so the ciphertext alone does not prove who sent it.

  • sessionKey: The 1120-byte encapsulated session key from PublicKey.seal
  • msgToOpen: The ciphertext to decrypt
  • msgToAuth: Additional authenticated data (must match what was used in seal)
  • domain: Application domain, the same as the sender's

Throws if sessionKey is not 1120 bytes long, or if decryption fails. A wrong key, a tampered ciphertext and a mismatched msgToAuth or domain all fail alike.

Implementation

Uint8List open({
  required Uint8List sessionKey,
  required Uint8List msgToOpen,
  required Uint8List msgToAuth,
  required Uint8List domain,
}) => _live.open(
  sessionKey: sessionKey,
  msgToOpen: msgToOpen,
  msgToAuth: msgToAuth,
  domain: domain,
);