SDKs
...
Tutorials
Licensing Scenarios

Air-Gapped Licensing

11min
air gap licensing is a useful feature for isolated environments the concept is similar to offline license management the main difference is that in regular offline activation we exchange files and and in air gapped environments we cannot use files so we have to rely on exchanging strings in this guide you will find the instructions for implementing air gap licensing using licensespring sdk prerequisites completed the getting started docid\ lsfy9tq3vfq4roow9shkd tutorial, specifically initialized licensemanager (or licensehandler ) with your configuration using the appropriate settings activated a key based license of any type air gap configuration the air gap public key is necessary to verify the confirmation code obtained from the air gap activation portal the public key can be found on the licensespring portal under settings >keys if the air gap public key is not set correctly in the configuration, the activation process will raise an airgapactivationexception with the message "confirmation code is invalid " to set the air gap public key in the configuration use configuration setairgappublickey("your air gap public key");configuration airgappublickey = "your air gap public key";configuration airgapkey = "your air gap public key"from licensespring licensefile config import configuration conf = configuration(product="your product key",api key="your api key", shared key="your shared key",file key=key,file iv=iv, is guard file enabled=true, air gap public key="your air gap public key") to secure the air gap activation, make sure that guard file option is not set to false this feature is enabled by default and ensures that the license will not be activated multiple times with the same data, enhancing security and reliability extendedoptions enableguardfile(true);extendedoptions protectofflineactivation = true; license activation to activate a license, follow these steps open the air gap activation portal and enter the license key it will display the key and initialization code use the getairgapactivationcode method to get the activation code, passing the key and initialization code as parameters additionally, retrieve the hardware id from the sdk configuration auto activationcode = licensemanager >getairgapactivationcode( initcode, licensekey ); auto hardwareid = configuration >gethardwareid();var activationcode = licensemanager getairgapactivationcode( initcode, licensekey ); var hardwareid = configuration hardwareid;let activationcode = try manager generateairgapactivationcode( initializationcode initcode, licensekey licensekey ) let hardwareid = configuration hardwareidfrom licensespring hardware import hardwareidprovider from licensespring licensefile license manager import licensemanager initialization code = "q/mwfwp1nwayarl8q7kso5cg2ykqs2qllnq3neesbsk=" license key = "uff3 e9ga vujq gmlk" manager = licensemanager(conf) activation code = manager get air gap activation code(initialization code=initialization code, license key=license key) print("activation code ",activation code) print("hardware id ",hardwareidprovider() get id())// go sdk v2 activationcode, err = lh getairgapactivationcode(initializationcode, licensekey) enter the license key, hardware id, and activation code in the activation portal it will provide the policy id and confirmation code and make the license active on the platform download the policy file from the licensing platform use the activateairgaplicense method, passing the policy id, key, confirmation code, and the path to the policy file or the location of multiple policy files this will activate the license on the device auto license = licensemanager >activateairgaplicense( "confirmation code", l"policy/file/path", "license key", policyid touint() );var license = licensemanager activateairgaplicense( "confirmation code", "policy/file/path", "license key", uint32 parse( "policy id" ) );try manager verifyairgapconfirmationcode( confirmationcode "confirm code", licensekey licensekey, policyid policyid ) let license = try manager activatelicense( airgappolicyfile policyfilelocation, licensekey licensekey, policyid policyid )confirmation = "erbqbue8giijqmpj972skipehqn0szq8th56inyo3odtmho1sutvsocosnjwb6rml98pj6sjybtpymovztg4hq==" policy id = "998" license key = "uff3 e9ga vujq gmlk" policy path = "path to air lic" manager = licensemanager(conf) license = manager activate air gap license( confirmation code=confirmation, policy path=policy path, license key=license key, policy id=policy id )// go sdk v2 ld, err = lh activateairgaplicense(confirmationcode, policypath, licensekey, policyid) air gap license fields license data contains the information if the license was activated using air gap approach and the license policy id, to get the corresponding fields use bool isairgapped = license >isairgapped(); std string policyid = license >policyid();bool isairgapped = license isairgapped; string policyid = license policyid;license isairgapactivatedprint("is air gapped ",license is air gapped()) print("policy id ",license policy id()) license deactivation the air gap deactivation process is similar to the air gap activation it contains the following steps open the air gap activation portal and switch to license deactivation enter the license key, it will display the key and initialization code use the getairgapdeactivationcode method to get the deactivation code, passing the key and initialization code as parameters additionally, retrieve the hardware id from the sdk configuration auto deactivationcode = licensemanager >getairgapdeactivationcode( initcode, licensekey ); auto hardwareid = configuration >gethardwareid();var deactivationcode = licensemanager getairgapdeactivationcode( initcode, licensekey ); var hardwareid = configuration hardwareid;deactivation code = license get deactivation code(initialization code) print("deactivation code ",deactivation code) print("hardware id ",hardwareidprovider() get id()) enter the license key, hardware id, and deactivation code in the activation portal it will provide the confirmation code and make the license inactive on the platform use the dectivateairgaplicense method, passing the confirmation code this will deactivate the license on the device and remove the local license file license >deactivateairgap( "confirmation code" );license deactivateairgap( "confirmation code" );confirmation code="your confirmation code" license deactivate air gap(confirmation code) errors during air gap activation, various exceptions may occur, including those encountered during regular activation additionally, in net, not all versions are supported in such cases, a licensespringexception with the message "air gap feature is not supported on net framework 3 5 4 6" may be thrown airgapactivationexception can be thrown during license activation and deactivation in case confirmation code verification failed