GordianKnot Personalisation
Overview
GordianKnot can be personalised to ensure differing securitySpaces. The personalisation is achieved via a SecurityPhrase which is processed via a set of digests to produce two 512-bit arrays (P and IV) which are then utilised in the various algorithms.
P is often split into 16 integers written as P1 through P16. Similarly IV is often split into 4 128-bit arrays written as IV1 through IV4
Sample
/* Access factory using security phrase */
final char[] mySecurityPhrase = ...
final GordianFactory myBaseFactory = GordianGenerator.createFactory(mySecurityPhrase);
Generation
The personalisation algorithm is as follows.
- Initialise intermediate result buffer I to all zeroes
- Create an array of all available digests that have an output length of 256-bits.
- Initialise all digests with a constant value followed by the security phrase
- Finish all digests, creating an array IA of the hashResults and xor each of these hashes into the intermediate buffer I
- Loop for 2K iterations.
- Update each digest with ALL the elements of IA
- Finish each digest, updating its hash in IA and xor-ing into I
- Obtain a seed S from the first 8 bytes of I and obtain a seeded random R using S
- Obtain an HMAC H from the seededRandom R
- Use HKDF with the HMAC H to expand the result I into P and IV.
Seeded Random
Several algorithms in GordianKnot require selection of various algorithms in a deterministic fashion based on a 4-byte seed S. This is performed by creating a 6-byte seed from the combination of the 4-byte seed and one of the Pn values, specific to the algorithm. This 6-byte seed in used to instantiate an instance of the deterministic Random class and algorithm selection is performed via this seeded Random instance.