cryptoBoxEasy static method
Implementation
static Uint8List cryptoBoxEasy(
Uint8List m, Uint8List n, Uint8List pk, Uint8List sk) {
RangeError.checkValueInInterval(n.length, cryptoBoxNoncebytes,
cryptoBoxNoncebytes, 'n', 'Invalid length');
RangeError.checkValueInInterval(pk.length, cryptoBoxPublickeybytes,
cryptoBoxPublickeybytes, 'pk', 'Invalid length');
RangeError.checkValueInInterval(sk.length, cryptoBoxSecretkeybytes,
cryptoBoxSecretkeybytes, 'sk', 'Invalid length');
final _c = calloc<Uint8>(m.length + cryptoBoxMacbytes);
final _m = m.toPointer();
final _n = n.toPointer();
final _pk = pk.toPointer();
final _sk = sk.toPointer();
try {
_cryptoBox
.crypto_box_easy(_c, _m, m.length, _n, _pk, _sk)
.mustSucceed('crypto_box_easy');
return _c.toList(m.length + cryptoBoxMacbytes);
} finally {
calloc.free(_c);
calloc.free(_m);
calloc.free(_n);
calloc.free(_pk);
calloc.free(_sk);
}
}