libsodium-compatible sealed boxes
Sealed boxes are designed to anonymously send messages to a recipient given their public key. Only the recipient can decrypt these messages, using their private key. While the recipient can verify the integrity of the message, it cannot verify the identity of the sender.
A message is encrypted using an ephemeral key pair, whose secret part is destroyed right after the encryption process.
Functions
fn open(m: []u8, c: []const u8, keypair: KeyPair) IdentityElementError || WeakPublicKeyError || AuthenticationError!void
Decrypt a message using a key pair.
m
must be exactlyseal_length
bytes sma…Decrypt a message using a key pair.
m
must be exactlyseal_length
bytes smaller thanc
, asc
also includes metadata.fn seal(c: []u8, m: []const u8, public_key: [public_length]u8) WeakPublicKeyError || IdentityElementError!void
Encrypt a message
m
for a recipient whose public key ispublic_key
.c
mus…Encrypt a message
m
for a recipient whose public key ispublic_key
.c
must beseal_length
bytes larger thanm
, so that the required metadata can be added.