getOid method

String getOid()

Gets the the OID of the certificate extension.

return The OID of the certificate extension. throws BiosealException An error has occurred during Bioseal Library execution.

Implementation

String getOid() {
  Pointer<Char> pOid = nullptr;
  Pointer<Int> pOidSize = calloc.allocate(1);
  pOidSize[0] = -1;
  try {
    var err = biosealSDK.id3BiosealCertificateExtension_GetOid(_pHandle.value, pOid, pOidSize);
    if (err == BiosealError.insufficientBuffer.value) {
      pOid = calloc.allocate(pOidSize.value);
      err = biosealSDK.id3BiosealCertificateExtension_GetOid(_pHandle.value, pOid, pOidSize);
      if (err != BiosealError.success.value) {
        throw BiosealException(err);
      }
    }
    final vOid = utf8.decode(Uint8List.fromList(pOid.cast<Uint8>().asTypedList(pOidSize.value)));
    return vOid;
  } finally {
    calloc.free(pOid);
    calloc.free(pOidSize);
  }
}