# getSubjectCommonName method

String getSubjectCommonName()

Gets the the subject common name (CN) from the certificate.

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

## Implementation

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