To pre-generate licenses, use com.adobe.flashaccess.sdk.license.pregen.LicenseFactory.getInstance() to obtain an instance of LicenseFactory . A License Server credential must be specified in order to sign the licenses generated by this factory. This class supports generating Leaf licenses without license chaining and Leaf and Root licenses with the Enhanced license chaining .
When generating a Leaf license, the content metadata must be specified using initContentInfo() . If the metadata includes multiple policies, or if you want to use a policy that was not in the metadata, use setSelectedPolicy() to specify the policy to use to generate the license. If you use a Policy Update List to track updates to policies, you can provide the Policy Update List to the License Factory before initializing the metadata using setPolicyUpdateList() .
When generating a Root license, the content metadata may be specified as described above. Alternatively, a Root license can be generated using a policy ( setSelectedPolicy() ) and license server URL ( setLicenseServerURL() ) instead of the metadata.
A License Server URL is required even if there is no Adobe Access License Server from which the clients can request a license. In this case, the License Server URL should specify a URL identifying the license issuer.
If the policy uses Enhanced License Chaining, a License Server credential must be specified in order to decrypt the Root Encryption Key in the policy ( setRootKeyRetrievalInfo() ).
If the policy requires a domain bound license, use setDomainCAs() to specify the Domain issuers from which the license server will accept domain tokens. One or more Domain CA certificates must be provided in order to validate the license recipient.
If the policy requires remote key delivery for iOS devices, the Key Server Certificate must be provided using setKeyServerCertificate() , unless a chained Leaf is being generated.
To generate a license, invoke generateLicense() and specify the license type (Leaf or Root) and one or more recipient certificates. The recipient certificate will either be a machine certificate or domain certificate, depending on the requirements specified in the policy. If you are generating a chained Leaf, a recipient is not required. After the license has been generated, it is possible to override the usage rules that were specified in the policy. Finally, invoke signLicense() to sign the license and obtain an instance of PreGeneratedLicense . The license can now be saved to a file (use getBytes() to retrieve the serialized license) or embedded in encrypted content. See, Embedding Licenses .
For sample code demonstrating pre-generated licenses, see com.adobe.flashaccess.samples.licensegen.GenerateLicense in the Reference Implementation Command Line Tools “samples” directory.