java.lang.Object
org.refcodes.security.alt.chaos.ChaosKey
All Implemented Interfaces:
Serializable, Key, SecretKey, Destroyable, org.refcodes.mixin.ChildAccessor<ChaosKey>, org.refcodes.mixin.Disposable, org.refcodes.mixin.EncodedAccessor

public class ChaosKey extends Object implements SecretKey, org.refcodes.mixin.EncodedAccessor, org.refcodes.mixin.ChildAccessor<ChaosKey>, org.refcodes.mixin.Disposable
The key holding the parameters for the chaos function. Thanks Christian Pontesegger for the very good example on "Writing your own JCA extensions - a full cipher" at: "http://codeandme.blogspot.de/2013/07/writing-your-own-jca-extensions-full.html" and for the very good example on "Writing your own JCA extensions - a simple digest " at: "http://codeandme.blogspot.de/2013/06/writing-your-own-jca-extensions-simple.html"
See Also:
  • Field Details

    • PROVIDER_NAME

      public static final String PROVIDER_NAME
      The name of the security provider.
      See Also:
    • A_BYTES

      public static final int A_BYTES
      The number of bytes required to store A
      See Also:
    • A_MAX

      public static final double A_MAX
      The maximum valid A value.
      See Also:
    • A_MIN

      public static final double A_MIN
      The minimum valid A value.
      See Also:
    • S_BYTES

      public static final int S_BYTES
      The number of bytes required to store S
      See Also:
    • S_MAX

      public static final long S_MAX
      The maximum valid S value (2^53-1 = MAX_SAFE_INTEGER when floating point is involved).
      See Also:
    • S_MIN

      public static final long S_MIN
      The minimum valid S value (-2^53 = MIN_SAFE_INTEGER when floating point is involved).
      See Also:
    • S_NEGATIVE_MAX

      public static final long S_NEGATIVE_MAX
      The maximum negative S value (S_NEGATIVE_MAX x S_POSITIVE_MIN = 256 possibilities, which is the range of values one byte can represent, which in turn is he atomic data to be encrypted / decrypted).
      See Also:
    • S_POSITIVE_MIN

      public static final long S_POSITIVE_MIN
      The minimum positive S value (S_NEGATIVE_MAX x S_POSITIVE_MIN = 256 possibilities, which is the range of values one byte can represent, which in turn is he atomic data to be encrypted / decrypted).
      See Also:
    • X_BYTES

      public static final int X_BYTES
      The number of bytes required to store X
      See Also:
    • X_MAX

      public static final double X_MAX
      The maximum valid X value.
      See Also:
    • X_MIN

      public static final double X_MIN
      The minimum valid X value.
      See Also:
    • ENCODED_LENGTH

      public static final int ENCODED_LENGTH
      The overall encoded length in bytes of the ChaosKey including the ChaosOptions.
      See Also:
  • Constructor Details

    • ChaosKey

      public ChaosKey(byte[] aEncoded)
      Instantiates the ChaosKey by reversing the result of the getEncoded() operation where the byte array contains the values x0, a and s (excluding the ChaosOptions). The values use a big endian representation. The byte array being passed is to be of the size as returned by getEncodedLength(). The number of bytes required by each value in the byte array are defined in the constants 8, A_BYTES and S_BYTES respectively and in that order.
      Parameters:
      aEncoded - The encoded representation of the chaos key.
    • ChaosKey

      public ChaosKey(double x0, double a, long s)
      Instantiates a new ChaosKey directly from the provided double values. Make sure your provided arguments are within the allowed bounds;
      Parameters:
      x0 - the x0: (0 <= x0 <= 1 )
      a - the a: (a <= 3.57 <= 4 )
      s - the s: (Integer.MAX_VALUE >= s >=Integer.MAX_VALUE AND 16 <= s <= -16)
    • ChaosKey

      public ChaosKey(double x0, double a, long s, ChaosOptions aChaosOptions)
      Instantiates a new ChaosKey directly from the provided double values. Make sure your provided arguments are within the allowed bounds;
      Parameters:
      x0 - the x0: (0 <= x0 <= 1 )
      a - the a: (a <= 3.57 <= 4 )
      s - the s: (Integer.MAX_VALUE >= s >=Integer.MAX_VALUE AND 16 <= s <= -16)
      aChaosOptions - The ChaosMode (ChaosOptions) to use to enhance Chaos-based encryption by enabling various additional processing steps.
    • ChaosKey

      public ChaosKey(int x0, int a, int s)
      Instantiates a new ChaosKey from the provided integer values. The integers are converted to the valid ranges of double values for invoking the constructor ChaosKey(double, double, long). You can use values in the range of Integer.MIN_VALUE and Integer.MAX_VALUE.
      Parameters:
      x0 - The value from which to calculate the valid x0 double.
      a - The value from which to calculate the valid a double.
      s - The value from which to calculate the valid s double.
    • ChaosKey

      public ChaosKey(int x0, int a, int s, ChaosOptions aChaosOptions)
      Instantiates a new ChaosKey from the provided integer values. The integers are converted to the valid ranges of double values for invoking the constructor ChaosKey(double, double, long). You can use values in the range of Integer.MIN_VALUE and Integer.MAX_VALUE.
      Parameters:
      x0 - The value from which to calculate the valid x0 double.
      a - The value from which to calculate the valid a double.
      s - The value from which to calculate the valid s double.
      aChaosOptions - The ChaosMode (ChaosOptions) to use to enhance Chaos-based encryption by enabling various additional processing steps.
    • ChaosKey

      public ChaosKey(char[] aSecret)
      Instantiates a new ChaosKey by calculating x0, a and s from the provided char array.
      Parameters:
      aSecret - The char array (in contrast to a String, a char array can be invalidated after use by overwriting its array elements with random values) from which to calculate x0, a and s.
    • ChaosKey

      public ChaosKey(String aSecret)
      Instantiates a new ChaosKey by calculating x0, a and s from the provided String.
      Parameters:
      aSecret - The String from which to calculate x0, a and s.
    • ChaosKey

      public ChaosKey(char[] aSecret, ChaosOptions aChaosOptions)
      Instantiates a new ChaosKey by calculating x0, a and s from the provided char array.
      Parameters:
      aSecret - The char array (in contrast to a String, a char array can be invalidated after use by overwriting its array elements with random values) from which to calculate x0, a and s.
      aChaosOptions - The ChaosMode (ChaosOptions) to use to enhance Chaos-based encryption.
    • ChaosKey

      public ChaosKey(String aSecret, ChaosOptions aChaosOptions)
      Instantiates a new ChaosKey by calculating x0, a and s from the provided String.
      Parameters:
      aSecret - The String from which to calculate x0, a and s.
      aChaosOptions - The ChaosMode (ChaosOptions) to use to enhance Chaos-based encryption.
    • ChaosKey

      public ChaosKey(double x0, double a, long s, ChaosKey aChildKey)
      Instantiates a new ChaosKey directly from the provided double values. Make sure your provided arguments are within the allowed bounds;
      Parameters:
      x0 - the x0: (0 <= x0 <= 1 )
      a - the a: (a <= 3.57 <= 4 )
      s - the s: (Integer.MAX_VALUE >= s >=Integer.MAX_VALUE AND 16 <= s <= -16)
      aChildKey - The child ChaosKey being the successor of this ChaosKey to encrypt and the predecessor of this ChaosKey to decrypt.
    • ChaosKey

      public ChaosKey(int x0, int a, int s, ChaosKey aChildKey)
      Instantiates a new ChaosKey from the provided integer values. The integers are converted to the valid ranges of double values for invoking the constructor ChaosKey(double, double, long). You can use values in the range of Integer.MIN_VALUE and Integer.MAX_VALUE.
      Parameters:
      x0 - The value from which to calculate the valid x0 double.
      a - The value from which to calculate the valid a double.
      s - The value from which to calculate the valid s double.
      aChildKey - The child ChaosKey being the successor of this ChaosKey to encrypt and the predecessor of this ChaosKey to decrypt.
    • ChaosKey

      public ChaosKey(int x0, int a, int s, ChaosOptions aChaosOptions, ChaosKey aChildKey)
      Instantiates a new ChaosKey from the provided integer values. The integers are converted to the valid ranges of double values for invoking the constructor ChaosKey(double, double, long). You can use values in the range of Integer.MIN_VALUE and Integer.MAX_VALUE.
      Parameters:
      x0 - The value from which to calculate the valid x0 double.
      a - The value from which to calculate the valid a double.
      s - The value from which to calculate the valid s double.
      aChaosOptions - The ChaosMode (ChaosOptions) to use to enhance Chaos-based encryption by enabling various additional processing steps.
      aChildKey - The child ChaosKey being the successor of this ChaosKey to encrypt and the predecessor of this ChaosKey to decrypt.
    • ChaosKey

      public ChaosKey(char[] aSecret, ChaosKey aChildKey)
      Instantiates a new ChaosKey by calculating x0, a and s from the provided char array.
      Parameters:
      aSecret - The char array (in contrast to a String, a char array can be invalidated after use by overwriting its array elements with random values) from which to calculate x0, a and s.
      aChildKey - The child ChaosKey being the successor of this ChaosKey to encrypt and the predecessor of this ChaosKey to decrypt.
    • ChaosKey

      public ChaosKey(String aSecret, ChaosKey aChildKey)
      Instantiates a new ChaosKey by calculating x0, a and s from the provided String.
      Parameters:
      aSecret - The String from which to calculate x0, a and s.
      aChildKey - The child ChaosKey being the successor of this ChaosKey to encrypt and the predecessor of this ChaosKey to decrypt.
    • ChaosKey

      public ChaosKey(byte[] aEncoded, ChaosKey aChildKey)
      Instantiates the ChaosKey by reversing the result of the getEncoded() operation where the byte array contains the values x0, a and s (including the ChaosOptions.getEncoded()). The values use a big endian representation. The byte array being passed is to be of the size as returned by getEncodedLength(). The number of bytes required by each value in the byte array are defined in the constants 8, A_BYTES and S_BYTES respectively and in that order.
      Parameters:
      aEncoded - The encoded representation of the chaos key.
      aChildKey - The child ChaosKey being the successor of this ChaosKey to encrypt and the predecessor of this ChaosKey to decrypt.
    • ChaosKey

      public ChaosKey(double x0, double a, long s, ChaosOptions aChaosOptions, ChaosKey aChildKey)
      Instantiates a new ChaosKey directly from the provided double values. Make sure your provided arguments are within the allowed bounds;
      Parameters:
      x0 - the x0: (0 <= x0 <= 1 )
      a - the a: (a <= 3.57 <= 4 )
      s - the s: (Integer.MAX_VALUE >= s >=Integer.MAX_VALUE AND 16 <= s <= -16)
      aChaosOptions - The ChaosMode (ChaosOptions) to use to enhance Chaos-based encryption by enabling various additional processing steps.
      aChildKey - The child ChaosKey being the successor of this ChaosKey to encrypt and the predecessor of this ChaosKey to decrypt.
    • ChaosKey

      public ChaosKey(char[] aSecret, ChaosOptions aChaosOptions, ChaosKey aChildKey)
      Instantiates a new ChaosKey by calculating x0, a and s from the provided char array.
      Parameters:
      aSecret - The char array (in contrast to a String, a char array can be invalidated after use by overwriting its array elements with random values) from which to calculate x0, a and s.
      aChaosOptions - The ChaosMode (ChaosOptions) to use to enhance Chaos-based encryption.
      aChildKey - The child ChaosKey being the successor of this ChaosKey to encrypt and the predecessor of this ChaosKey to decrypt.
    • ChaosKey

      public ChaosKey(String aSecret, ChaosOptions aChaosOptions, ChaosKey aChildKey)
      Instantiates a new ChaosKey by calculating x0, a and s from the provided String.
      Parameters:
      aSecret - The String from which to calculate x0, a and s.
      aChaosOptions - The ChaosMode (ChaosOptions) to use to enhance Chaos-based encryption.
      aChildKey - The child ChaosKey being the successor of this ChaosKey to encrypt and the predecessor of this ChaosKey to decrypt.
  • Method Details

    • destroy

      public void destroy() throws DestroyFailedException
      Specified by:
      destroy in interface Destroyable
      Throws:
      DestroyFailedException
    • dispose

      public void dispose()
      Specified by:
      dispose in interface org.refcodes.mixin.Disposable
    • getA

      public double getA()
      Gets the a.
      Returns:
      the a
    • getAlgorithm

      public String getAlgorithm()
      Specified by:
      getAlgorithm in interface Key
    • getOptions

      public ChaosOptions getOptions()
      Returns the ChaosOptions being used to enhance Chaos-based encryption by enabling various additional processing steps. Defaults to ChaosMode.NONE.
      Returns:
      the chaos metrics
    • getEncoded

      public byte[] getEncoded()
      Returns the key in its primary encoding format. Returns the bytes in a defined order representing the x0, a and s values (including the ChaosOptions.getEncoded()). The values use a big endian representation. The byte array being returned is of the size as returned by getEncodedLength(). The number of bytes required by each value in the byte array are defined in the constants 8, A_BYTES and S_BYTES respectively and in that order.
      Specified by:
      getEncoded in interface org.refcodes.mixin.EncodedAccessor
      Specified by:
      getEncoded in interface Key
      Returns:
      The encoded key being the according bytes representing the ChaosKey x0, a and s values.
    • toEncodedChain

      public byte[] toEncodedChain()
      Returns all encoded ChaosKey representations including this ChaosKey as well as all the nested ChaosKey children being their concatenated getEncoded() representation, the this being first and the bottom most child the last. Invoking the createKeyChain(byte[]) method with the result of this method reconstructs the ChaosKey chain's instances.
      Returns:
      The bytes representation of this ChaosKey and its nested ChaosKey children as of their getEncoded() representation.
    • getFormat

      public String getFormat()
      Specified by:
      getFormat in interface Key
    • getChild

      public ChaosKey getChild()
      Returns the next outer ChaosKey. It is the successor to encrypt (the last child ChaosKey is the last one to encrypt) and the predecessor to decrypt (the last child ChaosKey is the first one to decrypt).
      Specified by:
      getChild in interface org.refcodes.mixin.ChildAccessor<ChaosKey>
      Returns:
      the child ChaosKey being the successor of this ChaosKey to encrypt and the predecessor of this ChaosKey to decrypt.
    • getS

      public long getS()
      Gets the s.
      Returns:
      the s
    • getX0

      public double getX0()
      Gets the x0.
      Returns:
      the x0
    • toCertificate

      public String toCertificate()
      Creates a certificate for encryption and decryption from this ChaosKey. The certificate is not password protected!
      Returns:
      The String certificate representation of this ChaosKey.
    • toCertificate

      public String toCertificate(int aLineWidth)
      Creates a certificate for encryption and decryption from this ChaosKey. The certificate is not password protected!
      Parameters:
      aLineWidth - The line width to use for the encoded certificate data (excluding the head and the tail).
      Returns:
      The String certificate representation of this ChaosKey.
    • toCertificate

      public String toCertificate(String aPassword)
      Creates a password protected certificate for encryption and decryption from this ChaosKey.
      Parameters:
      aPassword - The password with which to protect the key.
      Returns:
      The String certificate representation of this ChaosKey.
    • toCertificate

      public String toCertificate(String aPassword, int aLineWidth)
      Creates a password protected certificate for encryption and decryption from this ChaosKey.
      Parameters:
      aPassword - The password with which to protect the key.
      aLineWidth - The line width to use for the encoded certificate data (excluding the head and the tail).
      Returns:
      The String certificate representation of this ChaosKey.
    • toCertificate

      public String toCertificate(String aPassword, ChaosOptions aChaosOptions)
      Creates password protected a certificate for encryption and decryption from this ChaosKey.
      Parameters:
      aPassword - The password with which to protect the key.
      aChaosOptions - The ChaosOptions to use for the certificate encryption.
      Returns:
      The String certificate representation of this ChaosKey.
    • toCertificate

      public String toCertificate(String aPassword, ChaosOptions aChaosOptions, int aLineWidth)
      Creates password protected a certificate for encryption and decryption from this ChaosKey.
      Parameters:
      aPassword - The password with which to protect the key.
      aChaosOptions - The ChaosOptions to use for the certificate encryption.
      aLineWidth - The line width to use for the encoded certificate data (excluding the head and the tail).
      Returns:
      The String certificate representation of this ChaosKey.
    • hashCode

      public int hashCode()
      Overrides:
      hashCode in class Object
    • equals

      public boolean equals(Object obj)
      Returns true if all the passed object is of type ChaosKey and all the attributes from the ChaosKey are equal to this instance's attributes (as of getX0(), getA() and getS() as well as getOptions() and getChild()).
      Overrides:
      equals in class Object
      Parameters:
      obj - the obj
      Returns:
      True if the objects are considered semantically equal.
    • toString

      public String toString()
      Overrides:
      toString in class Object
    • createFromCertificate

      public static ChaosKey createFromCertificate(File aCertFile, String aPassword) throws IOException
      Creates a ChaosKey (chain) from the password protected certificate retrieved from the given File.
      Parameters:
      aCertFile - The File pointing to the certificate representing the ChaosKey.
      aPassword - The password protecting the certificate.
      Returns:
      The ChaosKey (chain) represented by the certificate.
      Throws:
      IOException - thrown in case an I/O related problem occurred while accessing the File.
    • createFromCertificate

      public static ChaosKey createFromCertificate(InputStream aInputStream, String aPassword) throws IOException
      Creates a ChaosKey (chain) from the password protected certificate retrieved from the given InputStream.
      Parameters:
      aInputStream - The InputStream providing the certificate representing the ChaosKey.
      aPassword - The password protecting the certificate.
      Returns:
      The ChaosKey (chain) represented by the certificate.
      Throws:
      IOException - thrown in case an I/O related problem occurred while accessing the InputStream.
    • createFromCertificate

      public static ChaosKey createFromCertificate(String aCertificate, String aPassword)
      Creates a ChaosKey (chain) from the password protected certificate.
      Parameters:
      aCertificate - The certificate representing the ChaosKey.
      aPassword - The password protecting the certificate.
      Returns:
      The ChaosKey (chain) represented by the certificate.
    • createFromCertificate

      public static ChaosKey createFromCertificate(File aCertFile) throws IOException
      Creates a ChaosKey (chain) from the unsecured certificate retrieved from the given File.
      Parameters:
      aCertFile - The File pointing to the certificate representing the ChaosKey.
      Returns:
      The ChaosKey (chain) represented by the certificate.
      Throws:
      IOException - thrown in case an I/O related problem occurred while accessing the File.
    • createFromCertificate

      public static ChaosKey createFromCertificate(InputStream aInputStream) throws IOException
      Creates a ChaosKey (chain) from the unsecured certificate retrieved from the given InputStream.
      Parameters:
      aInputStream - The InputStream providing the certificate representing the ChaosKey.
      Returns:
      The ChaosKey (chain) represented by the certificate.
      Throws:
      IOException - thrown in case an I/O related problem occurred while accessing the InputStream.
    • createFromCertificate

      public static ChaosKey createFromCertificate(String aCertificate)
      Creates a ChaosKey (chain) from the unsecured certificate.
      Parameters:
      aCertificate - The certificate representing the ChaosKey.
      Returns:
      The ChaosKey (chain) represented by the certificate.
    • createKeyChain

      public static ChaosKey createKeyChain(byte[] aEncodedChain)
      Creates a ChaosKey from the provided encoded chain representations (as of toEncodedChain()) including all the nested ChaosKey children.
      Parameters:
      aEncodedChain - The byte array representing the ChaosKey chain's encoding (as of toEncodedChain()).
      Returns:
      The reconstructed ChaosKey chain from the provided encoded chain representation.
    • createRndKeyChain

      public static ChaosKey createRndKeyChain(int aChainLength)
      Creates a random ChaosKey chain, where each ChaosKey references a child ChaosKey (as of getChild()) as defined by the provided chain length and each ChaosKey in the chain is initialized by its unique random values.
      Parameters:
      aChainLength - The number of ChaosKey instances chained behind each other as of getChild()
      Returns:
      the ChaosKey with the according chain length being initialized with random values.
    • createRndKeyChain

      public static ChaosKey createRndKeyChain(int aChainLength, ChaosOptions... aChaosOptions)
      Creates a random ChaosKey chain, where each ChaosKey references a child ChaosKey (as of getChild()) as defined by the provided chain length and each ChaosKey in the chain is initialized by its unique random values.
      Parameters:
      aChainLength - The number of ChaosKey instances chained behind each other as of getChild()
      aChaosOptions - The ChaosOptions to use for each ChaosKey, the first one is used for the top most parent ChaosKey, the others for the succeeding ChaosKey children. The last ChaosOptions element is used for any ChaosKey to be created exceeding the length of the ChaosOptions elements.
      Returns:
      the ChaosKey with the according chain length being initialized with random values.
    • createRndKey

      public static ChaosKey createRndKey()
      Creates a random ChaosKey. Use getX0(), getA() and getS() or getEncoded() to retrieve the parameters of the created ChaosKey.
      Returns:
      the ChaosKey being initialized with random values.
    • createRndKey

      public static ChaosKey createRndKey(ChaosOptions aChaosOptions)
      Creates a random ChaosKey. Use getX0(), getA() and getS() or getEncoded() to retrieve the parameters of the created ChaosKey.
      Parameters:
      aChaosOptions - The ChaosMode (ChaosOptions) to use to enhance Chaos-based encryption.
      Returns:
      the ChaosKey being initialized with random values.
    • createRndKey

      public static ChaosKey createRndKey(ChaosKey aChildKey)
      Creates a random ChaosKey. Use getX0(), getA() and getS() or getEncoded() to retrieve the parameters of the created ChaosKey.
      Parameters:
      aChildKey - The child ChaosKey being the successor of this ChaosKey to encrypt and the predecessor of this ChaosKey to decrypt.
      Returns:
      the ChaosKey being initialized with random values.
    • createRndKey

      public static ChaosKey createRndKey(ChaosOptions aChaosOptions, ChaosKey aChildKey)
      Creates a random ChaosKey. Use getX0(), getA() and getS() or getEncoded() to retrieve the parameters of the created ChaosKey.
      Parameters:
      aChaosOptions - The ChaosMode (ChaosOptions) to use to enhance Chaos-based encryption.
      aChildKey - The child ChaosKey being the successor of this ChaosKey to encrypt and the predecessor of this ChaosKey to decrypt.
      Returns:
      the ChaosKey being initialized with random values.
    • asCertificateOptions

      public static ChaosOptions asCertificateOptions(File aCertFile) throws IOException, IllegalArgumentException
      Creates a ChaosOptions of the (secured) certificate itself (and not the therein contained key chain) retrieved from the given File.
      Parameters:
      aCertFile - The File pointing to the certificate representing which's ChaosOptions are to be determined.
      Returns:
      The ChaosOptions of the certificate itself or null if it is an unsecured certificate.
      Throws:
      IOException - thrown in case an I/O related problem occurred while accessing the File.
      IllegalArgumentException - thrown in case the provided certificate does not match a ChaosKey certificate notation.
    • asCertificateOptions

      public static ChaosOptions asCertificateOptions(InputStream aInputStream) throws IOException, IllegalArgumentException
      Creates a ChaosOptions of the (secured) certificate itself (and not the therein contained key chain) retrieved from the given InputStream.
      Parameters:
      aInputStream - The InputStream pointing to the certificate representing which's ChaosOptions are to be determined.
      Returns:
      The ChaosOptions of the certificate itself or null if it is an unsecured certificate
      Throws:
      IOException - thrown in case an I/O related problem occurred while accessing the InputStream.
      IllegalArgumentException - thrown in case the provided certificate does not match a ChaosKey certificate notation.
    • asCertificateOptions

      public static ChaosOptions asCertificateOptions(String aCertificate) throws IllegalArgumentException
      Creates a ChaosOptions of the (secured) certificate itself (and not the therein contained key chain) retrieved from the given String.
      Parameters:
      aCertificate - The String representing the certificatewhich's ChaosOptions are to be determined.
      Returns:
      The ChaosOptions of the certificate itself or null if it is an unsecured certificate
      Throws:
      IllegalArgumentException - thrown in case the provided certificate does not match a ChaosKey certificate notation.
    • getEncodedLength

      public static int getEncodedLength()
      Returns the length of this ChaosKey when represented as bytes (as of getEncoded()) (excluding the ChaosOptions).
      Returns:
      The number of bytes required to represent a ChaosKey x0, a and s values.
    • fixedLengthChildDepth

      protected int fixedLengthChildDepth()
      Determines the number of ChaosKey children in a row which when applied produce output of the same length as the input was. The ChaosKey child after that determined depth is either null or a variable length ChaosKey child (as of nextVariableLengthChild()).
      Returns:
      The number of ChaosKey children in a row which when applied produce output of the same length as the input was.
    • nextVariableLengthChild

      protected ChaosKey nextVariableLengthChild()
      Determines the next ChaosKey child (excluding this) which does not(!) produce output of the same length as the input was. This is the ChaosKey child after the determined depth of ChaosKey children in a row which when applied produce output of the same length as the input was (as of fixedLengthChildDepth()) or null if there is no such next ChaosKey.
      Returns:
      The next ChaosKey child which does not(!) produce output of the same length as the input was or null if there is no such next ChaosKey.
    • addToS

      protected static long addToS(long s, long aAddend)
      Adds a value to s so that a result exceeding S_MAX or {S_MIN is wrapped around accordingly and any result inbetween S_POSITIVE_MIN and S_NEGATIVE_MAX is moved past S_POSITIVE_MIN or S_NEGATIVE_MAX accordingly.
      Parameters:
      s - The value to which to add an summand.
      aAddend - The summand to be added to s.
      Returns:
      The accordingly wrapped new s value.
    • toA

      protected static double toA(int a)
      Creates a valid a double from the provided integer (values from Integer.MIN_VALUE to Integer.MAX_VALUE are allowed.
      Parameters:
      a - The integer as source for a
      Returns:
      The a inside the valid scope.
    • toA

      protected static double toA(long a)
      Creates a valid a double from the provided long (values from Long.MIN_VALUE to Long.MAX_VALUE are allowed).
      Parameters:
      a - The long as source for a
      Returns:
      The a inside the valid scope.
    • toS

      protected static long toS(int s)
      Creates a valid s double from the provided integer (values from Integer.MIN_VALUE to Integer.MAX_VALUE are allowed).
      Parameters:
      s - The integer as source for s
      Returns:
      The s inside the valid scope.
    • toS

      protected static long toS(long s)
      Creates a valid s long from the provided long (values from Long.MIN_VALUE to Long.MAX_VALUE are allowed).
      Parameters:
      s - The long as source for s
      Returns:
      The s inside the valid scope.
    • toX0

      protected static double toX0(int x0)
      Creates a valid x0 double from the provided integer (values from Integer.MIN_VALUE to Integer.MAX_VALUE are allowed.
      Parameters:
      x0 - The integer as source for x0
      Returns:
      The x0 inside the valid scope.
    • toX0

      protected static double toX0(long x0)
      Creates a valid x0 double from the provided long (values from Long.MIN_VALUE to Long.MAX_VALUE are allowed).
      Parameters:
      x0 - The long as source for x0
      Returns:
      The x0 inside the valid scope.
    • validate

      protected static void validate(double x0, double a, double s)
      Validates the given values whether them are in scope.
      Parameters:
      x0 - The x0 value to validate.
      a - The a value to validate.
      s - The s value to validate.
    • fromCertificateHead

      protected static ChaosOptions fromCertificateHead(String aCertificateHead) throws IllegalArgumentException
      Extracts a ChaosOptions instance from the provided certificate head.
      Parameters:
      aCertificateHead - The head (first line) of the certificate in question.
      Returns:
      The according ChaosOptions instance.
      Throws:
      IllegalArgumentException - in case the certificate head is not valid for creating a ChaosOptions instance.
    • fromCertificateTail

      protected static ChaosOptions fromCertificateTail(String aCertificateTail) throws IllegalArgumentException
      Extracts a ChaosOptions instance from the provided certificate tail.
      Parameters:
      aCertificateTail - The tail (last line) of the certificate in question.
      Returns:
      The according ChaosOptions instance.
      Throws:
      IllegalArgumentException - in case the certificate tail is not valid for creating a ChaosOptions instance.
    • toCertificateHead

      protected static String toCertificateHead()
      Creates a certificate head for an unsecured certificate.
      Returns:
      The accordingly created certificate head.
    • toCertificateHead

      protected static String toCertificateHead(ChaosOptions aChaosOptions)
      Creates a certificate head from the provided ChaosOptions instance for a password protected certificate.
      Parameters:
      aChaosOptions - The ChaosOptions from which to create the certificate head.
      Returns:
      The accordingly created certificate head.
    • toCertificateTail

      protected static String toCertificateTail()
      Creates a certificate tail for an unsecured certificate.
      Returns:
      The accordingly created certificate tail.
    • toCertificateTail

      protected static String toCertificateTail(ChaosOptions aChaosOptions)
      Creates a certificate tail from the provided ChaosOptions instance for a password protected certificate.
      Parameters:
      aChaosOptions - The ChaosOptions from which to create the certificate tail.
      Returns:
      The accordingly created certificate tail.