本文介绍了Java 默认加密/AES 行为的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

有谁知道默认的 Java 加密行为是为了什么:

Does anyone know what the default Java crypto behavior is for:

SecretKeySpec localSecretKeySpec = new SecretKeySpec(arrayOfByte, "AES");
Cipher localCipher = Cipher.getInstance("AES");

具体来说,我希望了解这些类如何生成 IV,以及仅指定AES"时的默认加密模式是什么.谢谢.

Specifically I am looking to understand how those classes generate the IV, as well as what is the default encryption mode when just specifying "AES". Thanks.

推荐答案

对于 Oracle JDK 7(已测试),AES 的默认密码是 AES/ECB/PKCS5Padding.Java 安全文档并没有提到这一点(http://docs.oracle.com/javase/6/docs/technotes/guides/security/StandardNames.html#algspec),必须做一些 JUnit 测试才能找出.

For Oracle JDK 7 (tested), the default cipher for AES is AES/ECB/PKCS5Padding. The Java Security documentation doesn't mention about this though (http://docs.oracle.com/javase/6/docs/technotes/guides/security/StandardNames.html#algspec), have to do some JUnit testing to find out.

这篇关于Java 默认加密/AES 行为的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

07-31 20:41