许可证激活和保存激活的许可证

时间:2014-05-20 19:29:23

标签: java license4j

我将License4J用于我的Java软件;它支持通过互联网激活许可证 我需要有关如何保存和加载激活的许可证文本的帮助。

String licenseKey = "AAAAA-BBBBB-CCCCC-DDDDD-EEEEE";
String publickey = "30819f300d06092a864...e32fb70203010001";
String internalString = "1395297610268";
String nameforValidation = null;
String companyforValidation = null;
int hardwareIDMethod = 0;

License license = LicenseValidator.validate(
                licenseKey,
                publickey,
                internalString,
                nameforValidation,
                companyforValidation,
                hardwareIDMethod);
System.out.println("License Validation Status: " + license.getValidationStatus());

License activatedLicense = LicenseValidator.autoActivate(license, "https://myServer/algas/autoactivate");
System.out.println("License Activation Status: " + activatedLicense.getActivationStatus());

在这里,我可以从activatedLicense.getLicenseString();

激活许可证文本字符串

如果我将此字符串保存在磁盘上,如何在每次启动时验证它;并且是许可证文本中存储的激活许可证的硬件ID,还是我必须在验证方法中指定硬件ID?

1 个答案:

答案 0 :(得分:0)

您应该像普通许可证文本一样验证激活的许可证文本。硬件ID信息已存储在许可证文本中。

License license = LicenseValidator.validate(
        licenseString,
        publickey,
        productID,
        productEdition,
        productVersion,
        currentDate,
        productReleaseDate);