Enum PBES2Algorithm

java.lang.Object
java.lang.Enum<PBES2Algorithm>
org.cryptacular.pbe.PBES2Algorithm
All Implemented Interfaces:
Serializable, Comparable<PBES2Algorithm>

public enum PBES2Algorithm extends Enum<PBES2Algorithm>
Supported password-based encryption algorithms for PKCS#5 PBES2 encryption scheme. The ciphers mentioned in PKCS#5 are supported as well as others in common use or of presumed value.
Version:
$Revision: 2745 $
  • Enum Constant Details

  • Field Details

    • oid

      private final String oid
      Algorithm identifier OID.
    • cipherSpec

      private final BufferedBlockCipherSpec cipherSpec
      Cipher algorithm specification.
    • blockSize

      private final int blockSize
      Cipher block size in bits.
    • keySize

      private final int keySize
      Cipher key size in bits.
  • Constructor Details

    • PBES2Algorithm

      private PBES2Algorithm(String id, BufferedBlockCipherSpec cipherSpec, int cipherBlockSize, int keySizeBits)
      Creates a new instance with given parameters.
      Parameters:
      id - Algorithm OID.
      cipherSpec - Cipher algorithm specification.
      cipherBlockSize - Block cipher size in bits.
      keySizeBits - Size of derived key in bits to be used with cipher.
  • Method Details

    • values

      public static PBES2Algorithm[] values()
      Returns an array containing the constants of this enum type, in the order they are declared.
      Returns:
      an array containing the constants of this enum type, in the order they are declared
    • valueOf

      public static PBES2Algorithm valueOf(String name)
      Returns the enum constant of this type with the specified name. The string must match exactly an identifier used to declare an enum constant in this type. (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 type has no constant with the specified name
      NullPointerException - if the argument is null
    • fromOid

      public static PBES2Algorithm fromOid(String oid)
      Gets the PBE algorithm for the given object identifier.
      Parameters:
      oid - PBE algorithm OID.
      Returns:
      Algorithm whose identifier equals given value.
      Throws:
      IllegalArgumentException - If no matching algorithm found.
    • getOid

      public String getOid()
      Returns:
      the oid
    • getCipherSpec

      public BufferedBlockCipherSpec getCipherSpec()
      Returns:
      Cipher algorithm specification.
    • getBlockSize

      public int getBlockSize()
      Returns:
      Cipher block size.
    • getKeySize

      public int getKeySize()
      Returns:
      Size of derived key in bits or -1 if algorithm does not define a key size.