import javax.crypto.KeyGenerator;
import javax.crypto.SecretKey;
public class Main {
public static void main(String[] argv) throws Exception {
// Generate a DES key
KeyGenerator keyGen = KeyGenerator.getInstance("DES");
SecretKey key = keyGen.generateKey();
// Generate a Blowfish key
keyGen = KeyGenerator.getInstance("Blowfish");
key = keyGen.generateKey();
// Generate a triple DES key
keyGen = KeyGenerator.getInstance("DESede");
key = keyGen.generateKey();
}
}
|