views:

92

answers:

1

How to generate one-time key in AES counter mode using java cryptography? I want to use that one-time key as session key in my PGP implementation?

+4  A: 

The key generation is not dependent on the cipher mode. To generate the key, use a KeyGenerator.

KeyGenerator aes = KeyGenerator.getInstance("AES");
aes.init(128);
SecretKey secret = aes.generateKey();
erickson