Enum Class SymmetricAlgorithm

java.lang.Object
java.lang.Enum<SymmetricAlgorithm>
cloud.opencode.base.crypto.enums.SymmetricAlgorithm
All Implemented Interfaces:
Serializable, Comparable<SymmetricAlgorithm>, Constable

public enum SymmetricAlgorithm extends Enum<SymmetricAlgorithm>
Symmetric encryption algorithm enumeration - 对称加密算法枚举 对称加密算法的枚举定义

Features | 主要功能:

  • All supported symmetric algorithm definitions - 所有支持的对称算法定义

Usage Examples | 使用示例:

SymmetricAlgorithm alg = SymmetricAlgorithm.AES_GCM_256;

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:
  • Enum Constant Details

    • AES_GCM_128

      public static final SymmetricAlgorithm AES_GCM_128
      AES-GCM with 128-bit key (Recommended AEAD)
    • AES_GCM_256

      public static final SymmetricAlgorithm AES_GCM_256
      AES-GCM with 256-bit key (Recommended AEAD)
    • AES_CBC_128

      public static final SymmetricAlgorithm AES_CBC_128
      AES-CBC with 128-bit key and PKCS5 padding
    • AES_CBC_256

      public static final SymmetricAlgorithm AES_CBC_256
      AES-CBC with 256-bit key and PKCS5 padding
    • AES_CTR_128

      public static final SymmetricAlgorithm AES_CTR_128
      AES-CTR with 128-bit key (Counter mode)
    • AES_CTR_256

      public static final SymmetricAlgorithm AES_CTR_256
      AES-CTR with 256-bit key (Counter mode)
    • CHACHA20_POLY1305

      public static final SymmetricAlgorithm CHACHA20_POLY1305
      ChaCha20-Poly1305 with 256-bit key (Recommended AEAD)
    • SM4_GCM

      public static final SymmetricAlgorithm SM4_GCM
      SM4-GCM with 128-bit key (Chinese national standard AEAD)
    • SM4_CBC

      public static final SymmetricAlgorithm SM4_CBC
      SM4-CBC with 128-bit key and PKCS5 padding (Chinese national standard)
  • Method Details

    • values

      public static SymmetricAlgorithm[] 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

      public static SymmetricAlgorithm valueOf(String name)
      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 name
      NullPointerException - if the argument is null
    • getTransformation

      public String getTransformation()
      Gets the cipher transformation string 获取密码转换字符串
      Returns:
      the transformation string (e.g., "AES/GCM/NoPadding")
    • getKeySize

      public int getKeySize()
      Gets the key size in bits 获取密钥大小(位)
      Returns:
      the key size
    • isAead

      public boolean isAead()
      Checks if this is an AEAD algorithm 检查是否为 AEAD 算法

      AEAD algorithms provide both confidentiality and authenticity

      Returns:
      true if this is an AEAD algorithm, false otherwise
    • isRecommended

      public boolean isRecommended()
      Checks if this algorithm is recommended for use 检查算法是否推荐使用

      AEAD algorithms are generally recommended for modern applications

      Returns:
      true if the algorithm is recommended, false otherwise