aesCtrBytes static method
Bytes-in / bytes-out variant of aesCtrEncryptRange — encrypts data
directly instead of reading from disk. Used by the cross-engine parity
test; production uploads use the range form so the plaintext stays off
the Dart heap.
Implementation
static Future<Uint8List?> aesCtrBytes({
required Uint8List key,
required Uint8List iv,
required int pos,
required Uint8List data,
}) {
assert(key.length == 32, 'AES-256 key must be 32 bytes, got ${key.length}');
assert(iv.length == 16, 'CTR IV must be 16 bytes, got ${iv.length}');
assert(pos >= 0, 'pos must be non-negative');
if (!isSupported) return Future.value(null);
return _channel.invokeMethod<Uint8List>('aesCtrBytes', <String, Object?>{
'key': key,
'iv': iv,
'pos': pos,
'data': data,
});
}