checkLicenseWithCard static method
- String? licensePath
Checks the license by using a card-based verification process. It takes the path to the license file and outputs a challenge response for further verification.
param licensePath The file path to the license that needs to be checked. return An array to hold the challenge response generated by the host. throws DocumentException An error has occurred during Document Library execution.
Implementation
static Uint8List checkLicenseWithCard(String? licensePath) {
Pointer<Char>? pLicensePath = licensePath?.toNativeUtf8().cast<Char>();
Pointer<UnsignedChar> pChallengeR1 = calloc.allocate(16);
Pointer<Int> pChallengeR1Size = calloc.allocate(1);
pChallengeR1Size[0] = 16;
try {
var err = documentSDK.id3DocumentLicense_CheckLicenseWithCard(pLicensePath ?? nullptr, pChallengeR1, pChallengeR1Size);
if (err == DocumentError.insufficientBuffer.value) {
calloc.free(pChallengeR1);
pChallengeR1 = calloc.allocate(pChallengeR1Size.value);
err = documentSDK.id3DocumentLicense_CheckLicenseWithCard(pLicensePath ?? nullptr, pChallengeR1, pChallengeR1Size);
}
if (err != DocumentError.success.value) {
throw DocumentException(err);
}
final vChallengeR1 = Uint8List.fromList(pChallengeR1.cast<Uint8>().asTypedList(pChallengeR1Size.value));
return vChallengeR1;
} finally {
if (pLicensePath != null) {
calloc.free(pLicensePath);
}
calloc.free(pChallengeR1);
calloc.free(pChallengeR1Size);
}
}