Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
如何使用 java 加密在 AES 计数器模式下生成一次性密钥?我想在我的 PGP 实现中使用该一次性密钥作为会话密钥吗?
密钥生成不依赖于密码模式。要生成密钥,请使用KeyGenerator.
KeyGenerator
KeyGenerator aes = KeyGenerator.getInstance("AES"); aes.init(128); SecretKey secret = aes.generateKey();