checkLicenseBufferWithCard static method
- Uint8List? licenseData
Checks the license using a buffer containing the license data and a card-based verification process. It outputs a challenge response for further verification.
param licenseData A buffer containing the license file data. return An array to hold the challenge response generated by the host. throws BiosealException An error has occurred during Bioseal Library execution.
Implementation
static Uint8List checkLicenseBufferWithCard(Uint8List? licenseData) {
Pointer<UnsignedChar>? pLicenseData;
if (licenseData != null) {
pLicenseData = calloc.allocate<UnsignedChar>(licenseData.length);
pLicenseData.cast<Uint8>().asTypedList(licenseData.length).setAll(0, licenseData);
}
Pointer<UnsignedChar> pChallengeR1 = calloc.allocate(16);
Pointer<Int> pChallengeR1Size = calloc.allocate(1);
pChallengeR1Size[0] = 16;
try {
var err = biosealSDK.id3BiosealLicense_CheckLicenseBufferWithCard(pLicenseData ?? nullptr, licenseData?.length ?? 0, pChallengeR1, pChallengeR1Size);
if (err == BiosealError.insufficientBuffer.value) {
calloc.free(pChallengeR1);
pChallengeR1 = calloc.allocate(pChallengeR1Size.value);
err = biosealSDK.id3BiosealLicense_CheckLicenseBufferWithCard(pLicenseData ?? nullptr, licenseData?.length ?? 0, pChallengeR1, pChallengeR1Size);
}
if (err != BiosealError.success.value) {
throw BiosealException(err);
}
final vChallengeR1 = Uint8List.fromList(pChallengeR1.cast<Uint8>().asTypedList(pChallengeR1Size.value));
return vChallengeR1;
} finally {
if (pLicenseData != null) {
calloc.free(pLicenseData);
}
calloc.free(pChallengeR1);
calloc.free(pChallengeR1Size);
}
}