org.apache.shiro.crypto
Enum OperationMode

java.lang.Object
  extended by java.lang.Enum<OperationMode>
      extended by org.apache.shiro.crypto.OperationMode
All Implemented Interfaces:
Serializable, Comparable<OperationMode>

public enum OperationMode
extends Enum<OperationMode>

A cipher mode of operation directs a cipher algorithm how to convert data during the encryption or decryption process. This enum represents all JDK-standard Cipher operation mode names as defined in JDK Security Standard Names, as well as a few more that are well-known and supported by other JCA Providers.

This enum exists to provide Shiro end-users type-safety when declaring an operation mode. This helps reduce error by providing a compile-time mechanism to specify a mode and guarantees a valid name that will be recognized by an underlying JCA Provider.

Standard or Non-Standard?

All modes listed specify whether they are a JDK standard mode or a non-standard mode. Standard modes are included in all JDK distributions. Non-standard modes can sometimes result in better performance or more secure output, but may not be available on the target JDK platform and rely on an external JCA Provider to be installed. Some providers (like Bouncy Castle) may support these modes however.

Since:
1.0
See Also:
Block Cipher Modes of Operation

Enum Constant Summary
CBC
           Cipher-block Chaining mode, defined in FIPS PUB 81.
CCM
          Counter with CBC-MAC mode* - for block ciphers with 128 bit block-size only.
CFB
          Cipher Feedback mode, defined in FIPS PUB 81.
CTR
          Counter Mode, aka Integer Counter Mode (ICM) and Segmented Integer Counter (SIC).
EAX
          EAX Mode*.
ECB
          Electronic Codebook mode, defined in FIPS PUB 81.
GCM
          Galois/Counter mode* - for block ciphers with 128 bit block-size only.
NONE
          No mode.
OCB
          Offset Codebook mode*.
OFB
          Output Feedback mode, defined in FIPS PUB 81.
PCBC
           Propagating Cipher Block Chaining mode, defined in Kerberos version 4.
 
Method Summary
static OperationMode valueOf(String name)
          Returns the enum constant of this type with the specified name.
static OperationMode[] 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

CBC

public static final OperationMode CBC
Cipher-block Chaining mode, defined in FIPS PUB 81.

This is a standard JDK operation mode and should be supported by all JDK environments.


CCM

public static final OperationMode CCM
Counter with CBC-MAC mode* - for block ciphers with 128 bit block-size only. See RFC 3610 for AES Ciphers. This mode has essentially been replaced by the more-capable EAX mode.

*THIS IS A NON-STANDARD MODE. It is not guaranteed to be supported across JDK installations. You must ensure you have a JCA Provider that can support this cipher operation mode. Bouncy Castle may be one such provider.


CFB

public static final OperationMode CFB
Cipher Feedback mode, defined in FIPS PUB 81.

This is a standard JDK operation mode and should be supported by all JDK environments.


CTR

public static final OperationMode CTR
Counter Mode, aka Integer Counter Mode (ICM) and Segmented Integer Counter (SIC). Counter is a simplification of OFB and updates the input block as a counter.

This is a standard JDK operation mode and should be supported by all JDK environments.


EAX

public static final OperationMode EAX
EAX Mode*. This is a patent-free but less-effecient alternative to OCB and has capabilities beyond what CCM can provide.

*THIS IS A NON-STANDARD MODE. It is not guaranteed to be supported across JDK installations. You must ensure you have a JCA Provider that can support this cipher operation mode. Bouncy Castle may be one such provider.


ECB

public static final OperationMode ECB
Electronic Codebook mode, defined in FIPS PUB 81. ECB is the only mode that does not require an Initialization Vector, but because of this, can be seen as less secure than operation modes that require an IV.

This is a standard JDK operation mode and should be supported by all JDK environments.


GCM

public static final OperationMode GCM
Galois/Counter mode* - for block ciphers with 128 bit block-size only.

*THIS IS A NON-STANDARD MODE. It is not guaranteed to be supported across JDK installations. You must ensure you have a JCA Provider that can support this cipher operation mode. Bouncy Castle may be one such provider.


NONE

public static final OperationMode NONE
No mode.

This is a standard JDK operation mode and should be supported by all JDK environments.


OCB

public static final OperationMode OCB
Offset Codebook mode*. Parallel mode that provides both message privacy and authenticity in a single pass. This is a very efficient mode, but is patent-encumbered. A less-efficient (two pass) alternative is available by using EAX mode.

*THIS IS A NON-STANDARD MODE. It is not guaranteed to be supported across JDK installations. You must ensure you have a JCA Provider that can support this cipher operation mode. Bouncy Castle may be one such provider.


OFB

public static final OperationMode OFB
Output Feedback mode, defined in FIPS PUB 81.

This is a standard JDK operation mode and should be supported by all JDK environments.


PCBC

public static final OperationMode PCBC
Propagating Cipher Block Chaining mode, defined in Kerberos version 4.

This is a standard JDK operation mode and should be supported by all JDK environments.

Method Detail

values

public static OperationMode[] 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 (OperationMode c : OperationMode.values())
    System.out.println(c);

Returns:
an array containing the constants of this enum type, in the order they are declared

valueOf

public static OperationMode 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


Copyright © 2004-2012 The Apache Software Foundation. All Rights Reserved.