Package com.saperion.common.crypto
Enum CipherStrategy
- java.lang.Object
-
- java.lang.Enum<CipherStrategy>
-
- com.saperion.common.crypto.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 aCipher
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
-
-
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 thisCipherStrategy
.int
getKeySize()
Returns the key size (number of bits) of thisCipherStrategy
.java.lang.String
getMode()
Returns the name of the mode of thisCipherStrategy
.java.lang.String
getPadding()
Returns the name of the padding of thisCipherStrategy
.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.
-
-
-
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 namejava.lang.NullPointerException
- if the argument is null
-
getAlgorithm
public java.lang.String getAlgorithm()
Returns the name of the encryption algorithm of thisCipherStrategy
.- Returns:
- the encryption algorithm
-
getMode
public java.lang.String getMode()
Returns the name of the mode of thisCipherStrategy
.- Returns:
- the mode
-
getPadding
public java.lang.String getPadding()
Returns the name of the padding of thisCipherStrategy
.- Returns:
- the padding
-
getKeySize
public int getKeySize()
Returns the key size (number of bits) of thisCipherStrategy
.- Returns:
- the key size
-
-