|
Bouncy Castle Cryptography Library 1.81 | |||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.bouncycastle.crypto.CipherKeyGenerator
org.bouncycastle.crypto.generators.Poly1305KeyGenerator
Generates keys for the Poly1305 MAC.
Poly1305 keys are 256 bit keys consisting of a 128 bit secret key used for the underlying block
cipher followed by a 128 bit value used for the polynomial portion of the Mac.
The 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
Field Summary |
Fields inherited from class org.bouncycastle.crypto.CipherKeyGenerator |
random, strength |
Constructor Summary | |
Poly1305KeyGenerator()
|
Method Summary | |
static void |
checkKey(byte[] key)
Checks a 32 byte key for compliance with the Poly1305 key requirements, e.g. |
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 r (second 16 bytes) portion of the key. |
byte[] |
generateKey()
Generates a 256 bit key in the format required for Poly1305 - e.g. |
void |
init(KeyGenerationParameters param)
Initialises the key generator. |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
public Poly1305KeyGenerator()
Method Detail |
public void init(KeyGenerationParameters param)
init
in class CipherKeyGenerator
param
- the parameters to be used for key generationpublic byte[] generateKey()
clamp(byte[])
.
generateKey
in class CipherKeyGenerator
public static void clamp(byte[] key)
key
- a 32 byte key value k[0] [] k[15], r[0] [] r[15]public static void checkKey(byte[] key)
clamp(byte[])
.
java.lang.IllegalArgumentException
- if the key is of the wrong length, or has invalid bits set
in the r portion of the key.
|
Bouncy Castle Cryptography Library 1.81 | |||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |