Poly1305 keys are 256 bit keys consisting of a 128 bit secret key used for the underlying block
cipher followed by a 128 bit r value used for the polynomial portion of the Mac.
The r value has a specific format with some bits required to be cleared, resulting in an
effective 106 bit key.
A separately generated 256 bit key can be modified to fit the Poly1305 key format by using the
clamp(byte[]) method to clear the required bits.
Poly1305
| Modifier and Type | Field and Description |
|---|---|
| private static final byte | |
| private static final byte |
| Access | Constructor and Description |
|---|---|
| public |
| Modifier and Type | Method and Description |
|---|---|
| public static void | checkKey(byte[] key)
Checks a 32 byte key for compliance with the Poly1305 key requirements, e.g.
|
| private static void | |
| public static void | clamp(byte[]
a 32 byte key value key)k[0] ... k[15], r[0] ... r[15]Modifies an existing 32 byte key value to comply with the requirements of the Poly1305 key by
clearing required bits in the |
| public byte[] | generateKey()
Overrides org. k[0] ...
|
| public void | init(KeyGenerationParameters
the parameters to be used for key generation param)
Initialises the key generator.
|
| R_MASK_HIGH_4 | back to summary |
|---|---|
| private static final byte R_MASK_HIGH_4 | |
| R_MASK_LOW_2 | back to summary |
|---|---|
| private static final byte R_MASK_LOW_2 | |
| Poly1305KeyGenerator | back to summary |
|---|---|
| public Poly1305KeyGenerator() | |
| checkKey | back to summary |
|---|---|
| public static void checkKey(byte[] key) Checks a 32 byte key for compliance with the Poly1305 key requirements, e.g.
| |
| checkMask | back to summary |
|---|---|
| private static void checkMask(byte b, byte mask) | |
| clamp | back to summary |
|---|---|
| public static void clamp(byte[] key) Modifies an existing 32 byte key value to comply with the requirements of the Poly1305 key by
clearing required bits in the
| |
| generateKey | back to summary |
|---|---|
| public byte[] generateKey() Overrides org. Generates a 256 bit key in the format required for Poly1305 - e.g.
| |
| init | back to summary |
|---|---|
| public void init(KeyGenerationParameters param) Overrides org. Initialises the key generator.
| |