com.ovea.tajin.crypto.OperationMode Maven / Gradle / Ivy
/**
* Copyright (C) 2011 Ovea
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.ovea.tajin.crypto;
/**
* 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 {@code 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.
*
* @see Block Cipher Modes of Operation
* @since 1.0
*/
public enum OperationMode {
/**
*
* Cipher-block Chaining mode, defined in FIPS
* PUB 81.
*
* This is a standard JDK operation mode and should be supported by all JDK environments.
*/
CBC,
/**
* 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 {@link #EAX 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.
*/
CCM,
/**
* Cipher
* Feedback mode, defined in FIPS PUB 81.
*
* This is a standard JDK operation mode and should be supported by all JDK environments.
*/
CFB,
/**
* Counter Mode, aka
* Integer Counter Mode (ICM) and Segmented Integer Counter (SIC). Counter is a simplification of {@link #OFB OFB}
* and updates the input block as a counter.
*
* This is a standard JDK operation mode and should be supported by all JDK environments.
*/
CTR,
/**
* EAX Mode*. This is a patent-free but less-effecient
* alternative to {@link #OCB OCB} and has capabilities beyond what {@link #CCM 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.
*/
EAX,
/**
* 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.
*/
ECB,
/**
* 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.
*/
GCM,
/**
* No mode.
*
* This is a standard JDK operation mode and should be supported by all JDK environments.
*/
NONE,
/**
* 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 {@link #EAX 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.
*/
OCB,
/**
* Output
* Feedback mode, defined in FIPS PUB 81.
*
* This is a standard JDK operation mode and should be supported by all JDK environments.
*/
OFB,
/**
*
* 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.
*/
PCBC
}
© 2015 - 2024 Weber Informatics LLC | Privacy Policy