Class Hello

java.lang.Object
com.iizix.license.v2.Hello

public final class Hello extends Object
The byte strings the identity proofs sign (LICENSE-V2-DESIGN.md sections 5.1, 5.2 and 5.4), one method each, so that no caller concatenates them itself and both ends of a wire build the same bytes:

Layout. The label in ASCII, one zero byte, then the fields: a nonce is exactly 32 bytes; a licence UUID is its 16 bytes big-endian (the most significant long first); a string is its UTF-8 bytes preceded by their count as two bytes big-endian. Every field has a fixed length or carries its length, so two different inputs never give the same bytes, and the label differs per proof, so a signature over one is never a signature over another (5.2).

Author:
Christopher Mindus
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    static final String
    The label of a member's proof to the hub principal: "iizi-hub-register/1".
    static final String
    The label of an installation's proof to the MLS: "iizi-install-prove/2".
    static final int
    The largest string a proof carries: 65535 bytes of UTF-8.
    static final String
    The label of the MLS's proof: "iizi-mls-hello/2".
    static final int
    The length of a nonce: 32 bytes.
  • Method Summary

    Modifier and Type
    Method
    Description
    static byte[]
    hubRegister(byte[] pn, String member, String run)
    The bytes a member signs to prove itself to the hub principal (5.4): "iizi-hub-register/1" 0x00 pn member run.
    static byte[]
    installProve(byte[] sn, byte[] cn, UUID lic)
    The bytes an installation signs to prove itself to the MLS (5.2 step 4): "iizi-install-prove/2" 0x00 sn cn lic.
    static byte[]
    mlsHello(byte[] cn, byte[] sn, UUID lic)
    The bytes the MLS signs to prove itself (5.1 step 2): "iizi-mls-hello/2" 0x00 cn sn lic.
    static byte[]
    Creates a nonce: 32 random bytes.
  • Field Details

    • MLS_HELLO

      public static final String MLS_HELLO
      The label of the MLS's proof: "iizi-mls-hello/2".
      See Also:
    • INSTALL_PROVE

      public static final String INSTALL_PROVE
      The label of an installation's proof to the MLS: "iizi-install-prove/2".
      See Also:
    • HUB_REGISTER

      public static final String HUB_REGISTER
      The label of a member's proof to the hub principal: "iizi-hub-register/1".
      See Also:
    • NONCE_LENGTH

      public static final int NONCE_LENGTH
      The length of a nonce: 32 bytes.
      See Also:
    • MAX_STRING_LENGTH

      public static final int MAX_STRING_LENGTH
      The largest string a proof carries: 65535 bytes of UTF-8.
      See Also:
  • Method Details

    • newNonce

      public static byte[] newNonce()
      Creates a nonce: 32 random bytes.
      Returns:
      The nonce.
    • mlsHello

      public static byte[] mlsHello(byte[] cn, byte[] sn, UUID lic)
      The bytes the MLS signs to prove itself (5.1 step 2): "iizi-mls-hello/2" 0x00 cn sn lic.
      Parameters:
      cn - The client's nonce, 32 bytes.
      sn - The MLS's nonce, 32 bytes.
      lic - The licence UUID.
      Returns:
      The bytes to sign or verify.
      Throws:
      IllegalArgumentException - If a nonce is not 32 bytes.
    • installProve

      public static byte[] installProve(byte[] sn, byte[] cn, UUID lic)
      The bytes an installation signs to prove itself to the MLS (5.2 step 4): "iizi-install-prove/2" 0x00 sn cn lic.
      Parameters:
      sn - The MLS's nonce, 32 bytes.
      cn - The client's nonce, 32 bytes.
      lic - The licence UUID.
      Returns:
      The bytes to sign or verify.
      Throws:
      IllegalArgumentException - If a nonce is not 32 bytes.
    • hubRegister

      public static byte[] hubRegister(byte[] pn, String member, String run)
      The bytes a member signs to prove itself to the hub principal (5.4): "iizi-hub-register/1" 0x00 pn member run.
      Parameters:
      pn - The principal's challenge, 32 bytes.
      member - The member ID.
      run - The member's run ID.
      Returns:
      The bytes to sign or verify.
      Throws:
      IllegalArgumentException - If the challenge is not 32 bytes or a string exceeds 65535 bytes of UTF-8.