In the section on keys we explained that Tink keys consist of key material plus parameters. Due to the fact that Tink tags ciphertexts, we saw that in some cases, the key also depends on the ID it has in the keyset.
To create a new key, Tink uses the following ingredients:
- An object describing all parameters
- The ID of the new key
- Uniform, cryptographically secure randomness
As an example, we consider HMAC (RFC 2014). To specify an HMAC computation, one needs to provide the following information, which form the key:
- The key material of HMAC.
- The hash function to be used.
- The output length of the HMAC (see (RFC 2014, Section 5)).
- The Tink specific prefix with which every tag starts (if any).
The corresponding parameters consist of all the information except the actual key material:
- The length of the key material.
- The hash function used.
- The output length of the HMAC.
- A specification of how to find the prefix from the ID.