Function open [src]

Decrypt a message using a key pair. m must be exactly seal_length bytes smaller than c, as c also includes metadata.

Prototype

pub fn open(m: []u8, c: []const u8, keypair: KeyPair) (IdentityElementError || WeakPublicKeyError || AuthenticationError)!void

Parameters

m: []u8c: []const u8keypair: KeyPair

Source

pub fn open(m: []u8, c: []const u8, keypair: KeyPair) (IdentityElementError || WeakPublicKeyError || AuthenticationError)!void { if (c.len < seal_length) { return error.AuthenticationFailed; } const epk = c[0..public_length]; const nonce = createNonce(epk.*, keypair.public_key); return Box.open(m, c[public_length..], nonce, epk.*, keypair.secret_key); }