com.monica.javacom.ciphering
Class AESKeyGenerator
java.lang.Object
|
+--com.monica.javacom.ciphering.AESKeyGenerator
- public class AESKeyGenerator
- extends java.lang.Object
Realizes an AESKeyGenerator. This object is used to create a proper AESKey for using it in an AES encoder/decoder.
The AESKey retruned by the generating function must be passed to the AES object.
- See Also:
AESKey
,
AES
Constructor Summary |
AESKeyGenerator(int in_keyLength,
java.util.Random in_random)
Constructs a new AESKeyGenerator. |
Method Summary |
AESKey |
generateAESKey()
Generates a new AESKey with the given keyLength and Random object. |
int |
getKeyLength()
Returns the keylength of the AESKey to be generated. |
void |
setKeyLength(int in_keyLength)
Sets the keylength of the AESKey to be generated. |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
AESKeyGenerator
public AESKeyGenerator(int in_keyLength,
java.util.Random in_random)
throws BadInputValueException
- Constructs a new AESKeyGenerator. If supplied with a proper Random object, it creates a secure AESKey.
- Parameters:
in_keyLength
- the keylength of the AESKey to be generated - default: 16in_random
- the Random object the AESKeyGenerator will use to generate the random numbers- Throws:
BadInputValueException
- the in_keyLength must be between 4 and 255
generateAESKey
public AESKey generateAESKey()
- Generates a new AESKey with the given keyLength and Random object.
- Returns:
- a new AESKey with the given parameters
getKeyLength
public int getKeyLength()
- Returns the keylength of the AESKey to be generated.
- Returns:
- the keylength of the AESKey
setKeyLength
public void setKeyLength(int in_keyLength)
throws BadInputValueException
- Sets the keylength of the AESKey to be generated.
- Parameters:
in_keyLength
- the keylength of the AESKey- Throws:
BadInputValueException
- the in_keyLength must be between 4 and 255