Class NullCipher
java.lang.Object
javax.crypto.Cipher
javax.crypto.NullCipher
The
NullCipher class is a class that provides an
"identity cipher" -- one that does not transform the plain text. As
a consequence, the ciphertext is identical to the plaintext. All
initialization methods do nothing, while the blocksize is set to 1
byte. Unlike other ciphers, the NullCipher has no state, and
will never throw an IllegalStateException when Cipher
methods are called.- Since:
- 1.4
-
Field Summary
Fields declared in class Cipher
DECRYPT_MODE, ENCRYPT_MODE, PRIVATE_KEY, PUBLIC_KEY, SECRET_KEY, UNWRAP_MODE, WRAP_MODEModifier and TypeFieldDescriptionstatic final intConstant used to initialize cipher to decryption mode.static final intConstant used to initialize cipher to encryption mode.static final intConstant used to indicate the to-be-unwrapped key is a "private key".static final intConstant used to indicate the to-be-unwrapped key is a "public key".static final intConstant used to indicate the to-be-unwrapped key is a "secret key".static final intConstant used to initialize cipher to key-unwrapping mode.static final intConstant used to initialize cipher to key-wrapping mode. -
Constructor Summary
Constructors -
Method Summary
Methods declared in class Cipher
doFinal, doFinal, doFinal, doFinal, doFinal, doFinal, doFinal, getAlgorithm, getBlockSize, getExemptionMechanism, getInstance, getInstance, getInstance, getIV, getMaxAllowedKeyLength, getMaxAllowedParameterSpec, getOutputSize, getParameters, getProvider, init, init, init, init, init, init, init, init, toString, unwrap, update, update, update, update, update, updateAAD, updateAAD, updateAAD, wrapModifier and TypeMethodDescriptionfinal byte[]doFinal()Finishes a multiple-part encryption or decryption operation, depending on how thisCipherobject was initialized.final byte[]doFinal(byte[] input) Encrypts or decrypts data in a single-part operation, or finishes a multiple-part operation.final intdoFinal(byte[] output, int outputOffset) Finishes a multiple-part encryption or decryption operation, depending on how thisCipherobject was initialized.final byte[]doFinal(byte[] input, int inputOffset, int inputLen) Encrypts or decrypts data in a single-part operation, or finishes a multiple-part operation.final intdoFinal(byte[] input, int inputOffset, int inputLen, byte[] output) Encrypts or decrypts data in a single-part operation, or finishes a multiple-part operation.final intdoFinal(byte[] input, int inputOffset, int inputLen, byte[] output, int outputOffset) Encrypts or decrypts data in a single-part operation, or finishes a multiple-part operation.final intdoFinal(ByteBuffer input, ByteBuffer output) Encrypts or decrypts data in a single-part operation, or finishes a multiple-part operation.final StringReturns the algorithm name of thisCipherobject.final intReturns the block size (in bytes).final ExemptionMechanismReturns the exemption mechanism object used with thisCipherobject.static final CiphergetInstance(String transformation) Returns aCipherobject that implements the specified transformation.static final CiphergetInstance(String transformation, String provider) Returns aCipherobject that implements the specified transformation.static final CiphergetInstance(String transformation, Provider provider) Returns aCipherobject that implements the specified transformation.final byte[]getIV()Returns the initialization vector (IV) in a new buffer.static final intgetMaxAllowedKeyLength(String transformation) Returns the maximum key length for the specified transformation according to the installed JCE jurisdiction policy files.static final AlgorithmParameterSpecgetMaxAllowedParameterSpec(String transformation) Returns anAlgorithmParameterSpecobject which contains the maximumCipherparameter value according to the jurisdiction policy file.final intgetOutputSize(int inputLen) Returns the length in bytes that an output buffer would need to be in order to hold the result of the nextupdateordoFinaloperation, given the input lengthinputLen(in bytes).final AlgorithmParametersReturns the parameters used with thisCipherobject.final ProviderReturns the provider of thisCipherobject.final voidinit(int opmode, Certificate certificate) Initializes thisCipherobject with the public key from the given certificate.final voidinit(int opmode, Certificate certificate, SecureRandom random) Initializes thisCipherobject with the public key from the given certificate and a source of randomness.final voidInitializes thisCipherobject with a key.final voidinit(int opmode, Key key, AlgorithmParameters params) Initializes thisCipherobject with a key and a set of algorithm parameters.final voidinit(int opmode, Key key, AlgorithmParameters params, SecureRandom random) Initializes thisCipherobject with a key, a set of algorithm parameters, and a source of randomness.final voidinit(int opmode, Key key, SecureRandom random) Initializes thisCipherobject with a key and a source of randomness.final voidinit(int opmode, Key key, AlgorithmParameterSpec params) Initializes thisCipherobject with a key and a set of algorithm parameters.final voidinit(int opmode, Key key, AlgorithmParameterSpec params, SecureRandom random) Initializes thisCipherobject with a key, a set of algorithm parameters, and a source of randomness.toString()Returns aStringrepresentation of thisCipherobject.final KeyUnwrap a previously wrapped key.final byte[]update(byte[] input) Continues a multiple-part encryption or decryption operation (depending on how thisCipherobject was initialized), processing another data part.final byte[]update(byte[] input, int inputOffset, int inputLen) Continues a multiple-part encryption or decryption operation (depending on how thisCipherobject was initialized), processing another data part.final intupdate(byte[] input, int inputOffset, int inputLen, byte[] output) Continues a multiple-part encryption or decryption operation (depending on how thisCipherobject was initialized), processing another data part.final intupdate(byte[] input, int inputOffset, int inputLen, byte[] output, int outputOffset) Continues a multiple-part encryption or decryption operation (depending on how thisCipherobject was initialized), processing another data part.final intupdate(ByteBuffer input, ByteBuffer output) Continues a multiple-part encryption or decryption operation (depending on how thisCipherobject was initialized), processing another data part.final voidupdateAAD(byte[] src) Continues a multi-part update of the Additional Authentication Data (AAD).final voidupdateAAD(byte[] src, int offset, int len) Continues a multi-part update of the Additional Authentication Data (AAD), using a subset of the provided buffer.final voidupdateAAD(ByteBuffer src) Continues a multi-part update of the Additional Authentication Data (AAD).final byte[]Wrap a key.Methods declared in class Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitModifier and TypeMethodDescriptionprotected Objectclone()Answers a new instance of the same class as the receiver, whose slots have been filled in with the values in the slots of the receiver.booleanCompares the argument to the receiver, and answers true if they represent the same object using a class specific comparison.protected voidfinalize()Deprecated, for removal: This API element is subject to removal in a future version.May cause performance issues, deadlocks and hangs.getClass()Answers the unique instance of java.lang.Class which represents the class of the receiver.inthashCode()Answers an integer hash code for the receiver.final voidnotify()Causes one thread which iswaiting on the receiver to be made ready to run.final voidCauses all threads which arewaiting on the receiver to be made ready to run.final voidwait()Causes the thread which sent this message to be made not ready to run pending some change in the receiver (as indicated bynotifyornotifyAll).final voidwait(long time) Causes the thread which sent this message to be made not ready to run either pending some change in the receiver (as indicated bynotifyornotifyAll) or the expiration of the timeout.final voidwait(long time, int frac) Causes the thread which sent this message to be made not ready to run either pending some change in the receiver (as indicated bynotifyornotifyAll) or the expiration of the timeout.
-
Constructor Details
-
NullCipher
public NullCipher()Creates aNullCipherobject.
-