1

如何使用 java 加密在 AES 计数器模式下生成一次性密钥?我想在我的 PGP 实现中使用该一次性密钥作为会话密钥吗?

4

1 回答 1

4

密钥生成不依赖于密码模式。要生成密钥,请使用KeyGenerator.

KeyGenerator aes = KeyGenerator.getInstance("AES");
aes.init(128);
SecretKey secret = aes.generateKey();
于 2010-06-04T19:31:49.227 回答