Class OctetLicenseCreator

java.lang.Object
rs.baselib.licensing.internal.OctetLicenseCreator
All Implemented Interfaces:
ILicenseCreator

public class OctetLicenseCreator
extends java.lang.Object
implements ILicenseCreator
Creates an Octet License.
Author:
ralph
  • Constructor Summary

    Constructors 
    Constructor Description
    OctetLicenseCreator()
    Constructor.
  • Method Summary

    Modifier and Type Method Description
    protected byte[] combine​(int prefix, byte[] signature)
    Builds the combined license key (raw bytes).
    java.lang.String createLicenseKey​(ILicenseContext context, ILicense license)
    Generates a key from the given license.
    static java.lang.String group​(java.lang.String s)
    Groups a string into 8-character blocks.
    protected byte[] sign​(ILicenseContext context, byte[] bytes)
    Signs the given byte array.

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Constructor Details

  • Method Details

    • createLicenseKey

      public java.lang.String createLicenseKey​(ILicenseContext context, ILicense license)
      Generates a key from the given license.
      Specified by:
      createLicenseKey in interface ILicenseCreator
      Parameters:
      context - the licensing context.
      license - the license to be created.
      Returns:
      the license key
    • sign

      protected byte[] sign​(ILicenseContext context, byte[] bytes) throws SigningException, java.security.NoSuchAlgorithmException, DecryptionException
      Signs the given byte array.
      Parameters:
      context - - the licensing context
      bytes - - the bytes to be signed
      Returns:
      the signature
      Throws:
      SigningException - - when signing fails
      java.security.NoSuchAlgorithmException - - when the signing algorithm is invalid
      DecryptionException - - when other signing error occur
    • combine

      protected byte[] combine​(int prefix, byte[] signature)
      Builds the combined license key (raw bytes).
      Parameters:
      prefix - the integer prefix basically containing the expiry time in seconds since epoch time
      signature - teh signature
      Returns:
      the combined byte array
    • group

      public static java.lang.String group​(java.lang.String s)
      Groups a string into 8-character blocks.
      Parameters:
      s - the string to be grouped
      Returns:
      the grouped string