Function hpke::HpkeSeal

source · []
pub fn HpkeSeal(
    config: HPKEConfig,
    pkR: &HpkePublicKey,
    info: &Info,
    aad: &AdditionalData,
    ptxt: &ByteSeq,
    psk: Option<Psk>,
    psk_id: Option<PskId>,
    skS: Option<HpkePrivateKey>,
    randomness: Randomness
) -> Result<HPKECiphertext, HpkeError>
Expand description

Encryption

In many cases, applications encrypt only a single message to a recipient’s public key. This section provides templates for HPKE APIs that implement stateless “single-shot” encryption and decryption using APIs specified in SetupBaseS() and ContextS_Seal:

def Seal<MODE>(pkR, info, aad, pt, ...):
  enc, ctx = Setup<MODE>S(pkR, info, ...)
  ct = ctx.Seal(aad, pt)
  return enc, ct

The MODE template parameter is one of Base, PSK, Auth, or AuthPSK. The optional parameters indicated by “…” depend on MODE and may be empty.

This function takes the <MODE> as argument in HPKEConfig.