getIssuerDistinguishedName method

String getIssuerDistinguishedName()

Gets the the distinguished name (DN) of the certificate issuer.

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

Implementation

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