From 0c25fdc79f6aeec643c9c91caeaacbc0813d206c Mon Sep 17 00:00:00 2001 From: Teddy Wing Date: Thu, 25 Oct 2018 17:10:21 +0200 Subject: LicenseHandler: Handle `APSetKey` returning false If `APSetKey()` returns false, the public key failed to get loaded by the AquaticPrime library, and we won't subsequently be able to `APVerifyLicenseFile()`. If `APSetKey()` fails, return `NO` from this `validateLicense` method. --- DomeKey/LicenseHandler.m | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/DomeKey/LicenseHandler.m b/DomeKey/LicenseHandler.m index 52c5bcf..1bad0b8 100644 --- a/DomeKey/LicenseHandler.m +++ b/DomeKey/LicenseHandler.m @@ -88,9 +88,12 @@ static NSString * const LICENSE_FILE_NAME = @"license.plist"; CFStringAppend(key, CFSTR("9AEF648830DA73C584DE402")); CFStringAppend(key, CFSTR("4AFD071F4F4E90021B")); - // TODO: returns false on failure - APSetKey(key); - BOOL validated = APVerifyLicenseFile(cf_path); + BOOL is_key_loaded = APSetKey(key); + BOOL validated = NO; + + if (is_key_loaded) { + validated = APVerifyLicenseFile(cf_path); + } CFRelease(cf_path); -- cgit v1.2.3