getInputData method

Uint8List getInputData()

Gets the the data to decrypt as a binary array.

return The data to decrypt as a binary array. throws BiosealException An error has occurred during Bioseal Library execution.

Implementation

Uint8List getInputData() {
  Pointer<UnsignedChar> pInputData = nullptr;
  Pointer<Int> pInputDataSize = calloc();
  pInputDataSize[0] = -1;
  try {
    var err = biosealSDK.id3BiosealDecryptionArgs_GetInputData(_pHandle.value, pInputData, pInputDataSize);
    if (err == BiosealError.insufficientBuffer.value) {
      pInputData = calloc.allocate(pInputDataSize.value);
      err = biosealSDK.id3BiosealDecryptionArgs_GetInputData(_pHandle.value, pInputData, pInputDataSize);
    }
    if (err != BiosealError.success.value) {
      throw BiosealException(err);
    }
    final vInputData = Uint8List.fromList(pInputData.cast<Uint8>().asTypedList(pInputDataSize.value));
    return vInputData;
  } finally {
    calloc.free(pInputData);
    calloc.free(pInputDataSize);
  }
}