Enum Class Mode

java.lang.Object
java.lang.Enum<Mode>
net.messagevortex.asn1.encryption.Mode
All Implemented Interfaces:
Serializable, Comparable<Mode>, Constable

public enum Mode extends Enum<Mode>
Enumeration to list available encryption modes.
  • Enum Constant Details

    • ECB

      public static final Mode ECB
    • CBC

      public static final Mode CBC
    • EAX

      public static final Mode EAX
    • CTR

      public static final Mode CTR
    • CCM

      public static final Mode CCM
    • GCM

      public static final Mode GCM
    • OCB

      public static final Mode OCB
    • OFB

      public static final Mode OFB
    • NONE

      public static final Mode NONE
  • Method Details

    • values

      public static Mode[] 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 Mode 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
    • getRequiresInitVector

      public boolean getRequiresInitVector()
    • getById

      public static Mode getById(int id)
      Get enumeration element by its ASN.1 ID.
      Parameters:
      id - the ID of the element to be obtained
      Returns:
      the element or null if the ID is unknown
    • getByString

      public static Mode getByString(String name)

      Get enumeration element by its name.

      Parameters:
      name - the name of the element to be obtained
      Returns:
      the element or null if the name is unknown
    • getDefault

      public static Mode getDefault(AlgorithmType type)

      Gets the currently set default value for the given type.

      Parameters:
      type - the type for which the default value is required
      Returns:
      the default value requested
    • getId

      public int getId()

      Gets the ASN.1 numerical ID.

      Returns:
      the numerical ID
    • toString

      public String toString()

      Gets the mode identifier as required by the encryption provider.

      This value is returned regardless of the support of the provider classes.

      Overrides:
      toString in class Enum<Mode>
      Returns:
      the mode identifier
    • getPaddings

      public Padding[] getPaddings()

      Gets all known paddings regardless of their support.

      Returns:
      an array of all paddings
    • getModes

      public static Mode[] getModes(Algorithm alg)

      Gets all cipher modes suitable for the specified algorithm.

      Parameters:
      alg - the algorithm to be supported
      Returns:
      an array of modes supported
    • toAsn1

      public org.bouncycastle.asn1.ASN1Enumerated toAsn1()

      Gets the corresponding ASN1 enumeration.

      Returns:
      the corresponding ASN1 enumeration