Enum Class Padding

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

public enum Padding extends Enum<Padding> implements Serializable

Enumeration listing all available padding types for encryption.

  • Enum Constant Details

    • NONE

      public static final Padding NONE
    • PKCS1

      public static final Padding PKCS1
    • OAEP_SHA256_MGF1

      public static final Padding OAEP_SHA256_MGF1
    • OAEP_SHA384_MGF1

      public static final Padding OAEP_SHA384_MGF1
    • OAEP_SHA512_MGF1

      public static final Padding OAEP_SHA512_MGF1
    • PKCS7

      public static final Padding PKCS7
  • Field Details

  • Method Details

    • values

      public static Padding[] 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 Padding 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
    • getAlgorithms

      public static Padding[] getAlgorithms(AlgorithmType at)

      Get applicable padding sets for a given Algorithm type.

      Parameters:
      at - the type of algorithm
      Returns:
      an array of supported paddings
    • getById

      public static Padding getById(int id)

      Get a padding by its ASN.1 ID.

      Parameters:
      id - the ASN.1 numericcal ID
      Returns:
      the padding or null if ID is unknown
    • getByString

      public static Padding getByString(String name)

      Get a padding by its name.

      Parameters:
      name - the name used by the cryptographic provider
      Returns:
      the padding or null if name is unknown
    • getDefault

      public static Padding getDefault(AlgorithmType at)

      Get the default padding for a given AlgorithmType.

      Parameters:
      at - the algorithm type
      Returns:
      the default padding for the given algorithm type
    • getId

      public int getId()

      Get the numeric ASN.1 id of the padding.

      Returns:
      the id of the padding
    • toString

      public String toString()

      Get the textual representation of the padding for the cryptographic provider.

      Overrides:
      toString in class Enum<Padding>
      Returns:
      the name used within the cryptographic provider
    • getMaxSize

      public int getMaxSize(int blockSize)

      Gets the maximum payload size.

      The payload size is calculated by <block size>-<padding overhead>.

      Parameters:
      blockSize - the block size of the cryptographic algorithm (usually equals the key size)
      Returns:
      the number of bytes a single block may hold including the padding information.
    • toAsn1

      public org.bouncycastle.asn1.ASN1Enumerated toAsn1()

      Get the corresponding ASN1 enumeration.

      Returns:
      the ASN1 enumeration representing this padding