Enum Class CipherMode
- All Implemented Interfaces:
Serializable, Comparable<CipherMode>, Constable
Cipher mode enumeration for symmetric encryption algorithms.
对称加密算法的加密模式枚举。
Features | 主要功能:
- CBC, CTR, GCM, ECB mode definitions - CBC、CTR、GCM、ECB 模式定义
Usage Examples | 使用示例:
CipherMode mode = CipherMode.GCM;
String name = mode.modeName();
Security | 安全性:
- Thread-safe: Yes - 线程安全: 是
- Null-safe: Partial - 空值安全: 部分
Performance | 性能特性:
- Time complexity: O(1) - 时间复杂度: O(1)
- Space complexity: O(1) - 空间复杂度: O(1)
- Since:
- JDK 25, opencode-base-crypto V1.0.0
- Author:
- Leon Soo www.LeonSoo.com
- See Also:
-
Nested Class Summary
Nested classes/interfaces inherited from class Enum
Enum.EnumDesc<E> -
Enum Constant Summary
Enum Constants -
Method Summary
Modifier and TypeMethodDescriptionstatic CipherModeReturns the enum constant of this class with the specified name.static CipherMode[]values()Returns an array containing the constants of this enum class, in the order they are declared.
-
Enum Constant Details
-
ECB
Deprecated.ECB mode is insecure as it does not hide data patterns. Identical plaintext blocks produce identical ciphertext blocks. Use GCM (recommended), CBC, or CTR mode instead.Electronic Codebook mode - Not recommended for most use cases. 电子密码本模式 - 不推荐用于大多数场景。 -
CBC
Cipher Block Chaining mode - Requires IV. 密码块链接模式 - 需要初始化向量。 -
CTR
Counter mode - Requires IV. 计数器模式 - 需要初始化向量。 -
GCM
Galois/Counter Mode - AEAD mode, recommended. 伽罗瓦/计数器模式 - AEAD 模式,推荐使用。 -
CCM
Counter with CBC-MAC mode - AEAD mode. CBC-MAC计数器模式 - AEAD 模式。
-
-
Method Details
-
values
Returns an array containing the constants of this enum class, in the order they are declared.- Returns:
- an array containing the constants of this enum class, in the order they are declared
-
valueOf
Returns the enum constant of this class with the specified name. The string must match exactly an identifier used to declare an enum constant in this class. (Extraneous whitespace characters are not permitted.)- Parameters:
name- the name of the enum constant to be returned.- Returns:
- the enum constant with the specified name
- Throws:
IllegalArgumentException- if this enum class has no constant with the specified nameNullPointerException- if the argument is null
-