i have an error with Uint64List in flutter Web (in pointycastle lib)
var length = Uint8List.view((Uint64List(2)..[0] = iv.length * 8).buffer);
"Error: Unsupported operation: Uint64List not supported on the web.
dart-sdk/lib/_internal/js_dev_runtime/private/ddc_runtime/errors.dart 266:49 throw_
dart-sdk/lib/_internal/js_dev_runtime/patch/typed_data_patch.dart 115:5 new
packages/pointycastle/block/modes/gcm.dart 81:36 [_computeInitialCounter]
packages/pointycastle/block/modes/gcm.dart 61:16 prepare
packages/pointycastle/src/impl/base_aead_block_cipher.dart 217:5 reset
packages/pointycastle/block/modes/gcm.dart 47:11 reset
packages/pointycastle/src/impl/base_aead_block_cipher.dart 117:5 init
packages/pointycastle/block/modes/gcm.dart 40:11 init
packages/crypto_keys/src/symmetric_operator.dart 71:16 encrypt
Do you know how to fix that ? Thx
For all practical values of IV length, you can fit the value in a 32 bit int. The following equivalent code runs fine in Dartpad and gives the same result as the above code in VM.
import 'dart:typed_data';
void main() {
final iv = Uint8List(12);
final length = Uint8List.view((Uint32List(4)..[0] = iv.length * 8).buffer);
print(length);
}
And, similarly, this:
var len = Uint8List.view((Uint32List(4)
..[2] = aad!.length * 8
..[0] = _processedBytes * 8)
.buffer);