public class TripleDESKeyGenerator extends VarLengthKeyGenerator
An application uses
for creating a KeyGenerator object for the TripleDES algorithm. For actually generating the requested secret TripleDES key from the KeyGenerator object just created, an application calls theKeyGenerator key_gen = KeyGenerator.getInstance("TripleDES");
generateKeymethod after having initialized the generator with some random seed or relied on the default system-provided source of randomness:
SecretKey triple_des_key = key_gen.generateKey();
A TripleDES key is composed of three DES keys. For extracting the inherent DES
keys, an application may use the
getEncoded method to get a byte
array representation of the TripleDES key and subsequently split it accordingly:
des key1 = first 8 bytes of key des key2 = second 8 bytes of key des key3 = first 8 bytes of key in case of 2 key triple DES, third 8 bytes otherwise
|Constructor and Description|
|Modifier and Type||Method and Description|
Generates a new key.
Initializes this key generator for the given strength with the given random seed.
protected void engineInit(int strength, java.security.SecureRandom random)