Enum CipherStrategy

  • All Implemented Interfaces:
    java.io.Serializable, java.lang.Comparable<CipherStrategy>

    public enum CipherStrategy
    extends java.lang.Enum<CipherStrategy>

    CipherStrategy enumerates the few strategies for a Cipher used by SAPERION.

    It defines the encryption algorithm, block mode, padding type and key size to use.

    If a new strategy is really needed, a new entry must be made and a new corresponding Cipher-implementation must be provided.

    Author:
    agz
    See Also:
    Cipher, CipherFactory
    • Enum Constant Summary

      Enum Constants 
      Enum Constant Description
      AES_128
      Algorithm = "AES"
      Mode = "CBC"
      Padding = "PKCS5Padding"
      KeySize = 128
      RSA_2048
      Algorithm = "RSA"
      Mode = "ECB"
      Padding = "PKCS1Padding"
      KeySize = 2048
    • Method Summary

      All Methods Static Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      java.lang.String getAlgorithm()
      Returns the name of the encryption algorithm of this CipherStrategy.
      int getKeySize()
      Returns the key size (number of bits) of this CipherStrategy.
      java.lang.String getMode()
      Returns the name of the mode of this CipherStrategy.
      java.lang.String getPadding()
      Returns the name of the padding of this CipherStrategy.
      static CipherStrategy valueOf​(java.lang.String name)
      Returns the enum constant of this type with the specified name.
      static CipherStrategy[] values()
      Returns an array containing the constants of this enum type, in the order they are declared.
      • Methods inherited from class java.lang.Enum

        clone, compareTo, equals, finalize, getDeclaringClass, hashCode, name, ordinal, toString, valueOf
      • Methods inherited from class java.lang.Object

        getClass, notify, notifyAll, wait, wait, wait
    • Enum Constant Detail

      • AES_128

        public static final CipherStrategy AES_128
        Algorithm = "AES"
        Mode = "CBC"
        Padding = "PKCS5Padding"
        KeySize = 128
      • RSA_2048

        public static final CipherStrategy RSA_2048
        Algorithm = "RSA"
        Mode = "ECB"
        Padding = "PKCS1Padding"
        KeySize = 2048
    • Method Detail

      • values

        public static CipherStrategy[] values()
        Returns an array containing the constants of this enum type, in the order they are declared. This method may be used to iterate over the constants as follows:
        for (CipherStrategy c : CipherStrategy.values())
            System.out.println(c);
        
        Returns:
        an array containing the constants of this enum type, in the order they are declared
      • valueOf

        public static CipherStrategy valueOf​(java.lang.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:
        java.lang.IllegalArgumentException - if this enum type has no constant with the specified name
        java.lang.NullPointerException - if the argument is null
      • getAlgorithm

        public java.lang.String getAlgorithm()
        Returns the name of the encryption algorithm of this CipherStrategy.
        Returns:
        the encryption algorithm
      • getMode

        public java.lang.String getMode()
        Returns the name of the mode of this CipherStrategy.
        Returns:
        the mode
      • getPadding

        public java.lang.String getPadding()
        Returns the name of the padding of this CipherStrategy.
        Returns:
        the padding
      • getKeySize

        public int getKeySize()
        Returns the key size (number of bits) of this CipherStrategy.
        Returns:
        the key size