public class SecretKeyGenerator
extends java.lang.Object
Stored alert access key generator.
We need to create cryptographically secure keys for accessing stored alert results, with the following characteristics:
- Strong guarantee against duplicates
- Hard to guess, hard to guess following ones from one
- (nice to have) Ability to perform cheap validity checking
The key has the following structure:
- 1 char: "a" or "o": indicates whether it's an alert key or occurrence key
- 32 chars : UUID
- 58 to 78 chars: base64 representation of
- 42 random bytes
- 16 bytes: MD5 of the 42 random bytes
The quick check verifies: length, first char, and that the MD5 matches the random bytes