getIssuerCommonName method

String getIssuerCommonName()

Gets the the common name (CN) of the certificate issuer.

return The common name (CN) of the certificate issuer. throws BiosealException An error has occurred during Bioseal Library execution.

Implementation

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