Adding AquaticPrime To Your Project
Open the "AquaticPrime" directory in the AquaticPrime distribution and add AquaticPrime.h to your XCode project. Then add either the framework or the library included in the AquaticPrime package. You will also need to add "-lcrypto" (without quotes) to your target's "Other Linker Flags" setting or else you will get undefined symbols.
Writing the Validator
Next, you will want to write some code to validate licenses that your application receives. I recommend picking a unique license extension and then registering that document type with your application, so when a user double-clicks on a license, the application will be able to handle it with application:openFile: and automatically register the application.
You will find the obfuscated public key in the "Product Key" tab of AquaticPrime Developer. Create a method or a function to check the license by pasting this string into it, and doing something like the following, which returns the name of the registered user:
You can return anything you want in this function, like the whole dictionary or any key-value pair or a BOOL, although I strongly recommend checking to make sure specific key-value pairs are what you expect (e.g. "Expiration" provides a sane date).
If you are just returning a BOOL, I have some convenience methods called verifyLicenseFile: and verifyLicenseData: that you can use. These wrap dictionaryForLicenseFile: and dictionaryForLicenseData: though, so no need to call it if you are already calling those like the example.
If you run into any trouble, send me an email and I'll help you sort it out.
You will find the obfuscated public key in the "Product Key" tab of AquaticPrime Developer. Create a method or a function to check the license by pasting this string into it, and doing something like the following, which returns the name of the registered user:
- (NSString*)checkLicense:(NSString*)licensePath
{
// Paste obfuscated public key here
NSMutableString *key = ...
// Instantiate AquaticPrime
AquaticPrime *licenseValidator = [AquaticPrime aquaticPrimeWithKey:key];
// Get the dictionary from the license file
// If the license is invalid, we get nil back instead of a dictionary
NSDictionary *licenseDictionary = [licenseValidator dictionaryForLicenseFile:licensePath];
if (licenseDictionary == nil)
return nil;
else
return [licenseDictionary objectForKey:@"Name"];
}
{
// Paste obfuscated public key here
NSMutableString *key = ...
// Instantiate AquaticPrime
AquaticPrime *licenseValidator = [AquaticPrime aquaticPrimeWithKey:key];
// Get the dictionary from the license file
// If the license is invalid, we get nil back instead of a dictionary
NSDictionary *licenseDictionary = [licenseValidator dictionaryForLicenseFile:licensePath];
if (licenseDictionary == nil)
return nil;
else
return [licenseDictionary objectForKey:@"Name"];
}
You can return anything you want in this function, like the whole dictionary or any key-value pair or a BOOL, although I strongly recommend checking to make sure specific key-value pairs are what you expect (e.g. "Expiration" provides a sane date).
If you are just returning a BOOL, I have some convenience methods called verifyLicenseFile: and verifyLicenseData: that you can use. These wrap dictionaryForLicenseFile: and dictionaryForLicenseData: though, so no need to call it if you are already calling those like the example.
If you run into any trouble, send me an email and I'll help you sort it out.
Blacklisting a License File
Sometimes your customers will not be as careful as they should be, and you will come across a license file that has been leaked or stolen. In this case, it is necessary to blacklist the license file.
To do this, open AquaticPrime Developer and select "License Info..." from the "Tools" menu. This will open a window onto which you can drag the rogue license file, and it will display some information about it.

Copy the string of hexadecimal digits after "License Hash:". Now you are ready to add some code to your application's license validation routine.
Now your application will no longer accept the blacklisted license file as valid.
To do this, open AquaticPrime Developer and select "License Info..." from the "Tools" menu. This will open a window onto which you can drag the rogue license file, and it will display some information about it.

Copy the string of hexadecimal digits after "License Hash:". Now you are ready to add some code to your application's license validation routine.
...
// Locate this line in your validation code:
// Instantiate AquaticPrime
AquaticPrime *licenseValidator = [AquaticPrime aquaticPrimeWithKey:key];
// Now add this new line of code:
// Blacklist bad licenses
[licenseValidator setBlacklist:[NSArray arrayWithObject:@"PASTE HEX DIGITS HERE"]];
...
// Locate this line in your validation code:
// Instantiate AquaticPrime
AquaticPrime *licenseValidator = [AquaticPrime aquaticPrimeWithKey:key];
// Now add this new line of code:
// Blacklist bad licenses
[licenseValidator setBlacklist:[NSArray arrayWithObject:@"PASTE HEX DIGITS HERE"]];
...
Now your application will no longer accept the blacklisted license file as valid.
