getValue method

Uint8List getValue()

Gets the A byte array that contains the value of the certificate extension.

return A byte array that contains the value of the certificate extension. throws BiosealException An error has occurred during Bioseal Library execution.

Implementation

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