# NullCipher

Added in[API level 1](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)  
Summary:[Inherited Constants](https://developer.android.com/reference/javax/crypto/NullCipher#inhconstants)\|[Ctors](https://developer.android.com/reference/javax/crypto/NullCipher#pubctors)\|[Inherited Methods](https://developer.android.com/reference/javax/crypto/NullCipher#inhmethods)  

# NullCipher

`
public


class
NullCipher
`  
`


``

extends `[Cipher](https://developer.android.com/reference/javax/crypto/Cipher)`


``


`

|---|---|-------------------------|
| [java.lang.Object](https://developer.android.com/reference/java/lang/Object) |||
| ↳ | [javax.crypto.Cipher](https://developer.android.com/reference/javax/crypto/Cipher) ||
|   | ↳ | javax.crypto.NullCipher |

<br />

*** ** * ** ***

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.

## Summary

|                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                       ### Inherited constants                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                        |
|------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| From class[javax.crypto.Cipher](https://developer.android.com/reference/javax/crypto/Cipher) |-------|--------------------------------------------------------------------------------------------------------------------------------------------------------------| | `int` | [DECRYPT_MODE](https://developer.android.com/reference/javax/crypto/Cipher#DECRYPT_MODE) Constant used to initialize cipher to decryption mode.              | | `int` | [ENCRYPT_MODE](https://developer.android.com/reference/javax/crypto/Cipher#ENCRYPT_MODE) Constant used to initialize cipher to encryption mode.              | | `int` | [PRIVATE_KEY](https://developer.android.com/reference/javax/crypto/Cipher#PRIVATE_KEY) Constant used to indicate the to-be-unwrapped key is a "private key". | | `int` | [PUBLIC_KEY](https://developer.android.com/reference/javax/crypto/Cipher#PUBLIC_KEY) Constant used to indicate the to-be-unwrapped key is a "public key".    | | `int` | [SECRET_KEY](https://developer.android.com/reference/javax/crypto/Cipher#SECRET_KEY) Constant used to indicate the to-be-unwrapped key is a "secret key".    | | `int` | [UNWRAP_MODE](https://developer.android.com/reference/javax/crypto/Cipher#UNWRAP_MODE) Constant used to initialize cipher to key-unwrapping mode.            | | `int` | [WRAP_MODE](https://developer.android.com/reference/javax/crypto/Cipher#WRAP_MODE) Constant used to initialize cipher to key-wrapping mode.                  | |

|                                                      ### Public constructors                                                       ||
|---------------------------------------------------------------------------------------------------------------------------------|---|
| ` `[NullCipher](https://developer.android.com/reference/javax/crypto/NullCipher#NullCipher())`() ` Creates a NullCipher object. |

| ### Inherited methods |
|-----------------------|---|
| From class` `[javax.crypto.Cipher](https://developer.android.com/reference/javax/crypto/Cipher)` ` |-----------------------------------------------------------------------------------------------------------------------------|-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------| | ` final int`                                                                                                                | ` `[doFinal](https://developer.android.com/reference/javax/crypto/Cipher#doFinal(byte[],%20int,%20int,%20byte[]))`(byte[] input, int inputOffset, int inputLen, byte[] output) ` Encrypts or decrypts data in a single-part operation, or finishes a multiple-part operation.                                                                                                                                                                                                                                                                                                             | | ` final int`                                                                                                                | ` `[doFinal](https://developer.android.com/reference/javax/crypto/Cipher#doFinal(byte[],%20int))`(byte[] output, int outputOffset) ` Finishes a multiple-part encryption or decryption operation, depending on how this cipher was initialized.                                                                                                                                                                                                                                                                                                                                           | | ` final byte[]`                                                                                                             | ` `[doFinal](https://developer.android.com/reference/javax/crypto/Cipher#doFinal())`() ` Finishes a multiple-part encryption or decryption operation, depending on how this cipher was initialized.                                                                                                                                                                                                                                                                                                                                                                                       | | ` final byte[]`                                                                                                             | ` `[doFinal](https://developer.android.com/reference/javax/crypto/Cipher#doFinal(byte[]))`(byte[] input) ` Encrypts or decrypts data in a single-part operation, or finishes a multiple-part operation.                                                                                                                                                                                                                                                                                                                                                                                   | | ` final int`                                                                                                                | ` `[doFinal](https://developer.android.com/reference/javax/crypto/Cipher#doFinal(byte[],%20int,%20int,%20byte[],%20int))`(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 int`                                                                                                                | ` `[doFinal](https://developer.android.com/reference/javax/crypto/Cipher#doFinal(java.nio.ByteBuffer,%20java.nio.ByteBuffer))`(`[ByteBuffer](https://developer.android.com/reference/java/nio/ByteBuffer)` input, `[ByteBuffer](https://developer.android.com/reference/java/nio/ByteBuffer)` output) ` Encrypts or decrypts data in a single-part operation, or finishes a multiple-part operation.                                                                                                                                                                                      | | ` final byte[]`                                                                                                             | ` `[doFinal](https://developer.android.com/reference/javax/crypto/Cipher#doFinal(byte[],%20int,%20int))`(byte[] input, int inputOffset, int inputLen) ` Encrypts or decrypts data in a single-part operation, or finishes a multiple-part operation.                                                                                                                                                                                                                                                                                                                                      | | ` final `[String](https://developer.android.com/reference/java/lang/String)                                                 | ` `[getAlgorithm](https://developer.android.com/reference/javax/crypto/Cipher#getAlgorithm())`() ` Returns the algorithm name of this`Cipher`object.                                                                                                                                                                                                                                                                                                                                                                                                                                      | | ` final int`                                                                                                                | ` `[getBlockSize](https://developer.android.com/reference/javax/crypto/Cipher#getBlockSize())`() ` Returns the block size (in bytes).                                                                                                                                                                                                                                                                                                                                                                                                                                                     | | ` final `[ExemptionMechanism](https://developer.android.com/reference/javax/crypto/ExemptionMechanism)                      | ` `[getExemptionMechanism](https://developer.android.com/reference/javax/crypto/Cipher#getExemptionMechanism())`() ` Returns the exemption mechanism object used with this cipher.                                                                                                                                                                                                                                                                                                                                                                                                        | | ` final byte[]`                                                                                                             | ` `[getIV](https://developer.android.com/reference/javax/crypto/Cipher#getIV())`() ` Returns the initialization vector (IV) in a new buffer.                                                                                                                                                                                                                                                                                                                                                                                                                                              | | ` static final `[Cipher](https://developer.android.com/reference/javax/crypto/Cipher)                                       | ` `[getInstance](https://developer.android.com/reference/javax/crypto/Cipher#getInstance(java.lang.String))`(`[String](https://developer.android.com/reference/java/lang/String)` transformation) ` Returns a`Cipher`object that implements the specified transformation.                                                                                                                                                                                                                                                                                                                 | | ` static final `[Cipher](https://developer.android.com/reference/javax/crypto/Cipher)                                       | ` `[getInstance](https://developer.android.com/reference/javax/crypto/Cipher#getInstance(java.lang.String,%20java.lang.String))`(`[String](https://developer.android.com/reference/java/lang/String)` transformation, `[String](https://developer.android.com/reference/java/lang/String)` provider) ` Returns a`Cipher`object that implements the specified transformation.                                                                                                                                                                                                              | | ` static final `[Cipher](https://developer.android.com/reference/javax/crypto/Cipher)                                       | ` `[getInstance](https://developer.android.com/reference/javax/crypto/Cipher#getInstance(java.lang.String,%20java.security.Provider))`(`[String](https://developer.android.com/reference/java/lang/String)` transformation, `[Provider](https://developer.android.com/reference/java/security/Provider)` provider) ` Returns a`Cipher`object that implements the specified transformation.                                                                                                                                                                                                | | ` static final int`                                                                                                         | ` `[getMaxAllowedKeyLength](https://developer.android.com/reference/javax/crypto/Cipher#getMaxAllowedKeyLength(java.lang.String))`(`[String](https://developer.android.com/reference/java/lang/String)` transformation) ` Returns the maximum key length for the specified transformation according to the installed JCE jurisdiction policy files.                                                                                                                                                                                                                                       | | ` static final `[AlgorithmParameterSpec](https://developer.android.com/reference/java/security/spec/AlgorithmParameterSpec) | ` `[getMaxAllowedParameterSpec](https://developer.android.com/reference/javax/crypto/Cipher#getMaxAllowedParameterSpec(java.lang.String))`(`[String](https://developer.android.com/reference/java/lang/String)` transformation) ` Returns an AlgorithmParameterSpec object which contains the maximum cipher parameter value according to the jurisdiction policy file.                                                                                                                                                                                                                   | | ` final int`                                                                                                                | ` `[getOutputSize](https://developer.android.com/reference/javax/crypto/Cipher#getOutputSize(int))`(int inputLen) ` Returns the length in bytes that an output buffer would need to be in order to hold the result of the next`update`or`doFinal`operation, given the input length`inputLen`(in bytes).                                                                                                                                                                                                                                                                                   | | ` final `[AlgorithmParameters](https://developer.android.com/reference/java/security/AlgorithmParameters)                   | ` `[getParameters](https://developer.android.com/reference/javax/crypto/Cipher#getParameters())`() ` Returns the parameters used with this cipher.                                                                                                                                                                                                                                                                                                                                                                                                                                        | | ` final `[Provider](https://developer.android.com/reference/java/security/Provider)                                         | ` `[getProvider](https://developer.android.com/reference/javax/crypto/Cipher#getProvider())`() ` Returns the provider of this`Cipher`object.                                                                                                                                                                                                                                                                                                                                                                                                                                              | | ` final void`                                                                                                               | ` `[init](https://developer.android.com/reference/javax/crypto/Cipher#init(int,%20java.security.Key,%20java.security.AlgorithmParameters))`(int opmode, `[Key](https://developer.android.com/reference/java/security/Key)` key, `[AlgorithmParameters](https://developer.android.com/reference/java/security/AlgorithmParameters)` params) ` Initializes this cipher with a key and a set of algorithm parameters.                                                                                                                                                                        | | ` final void`                                                                                                               | ` `[init](https://developer.android.com/reference/javax/crypto/Cipher#init(int,%20java.security.cert.Certificate,%20java.security.SecureRandom))`(int opmode, `[Certificate](https://developer.android.com/reference/java/security/cert/Certificate)` certificate, `[SecureRandom](https://developer.android.com/reference/java/security/SecureRandom)` random) ` Initializes this cipher with the public key from the given certificate and a source of randomness.                                                                                                                      | | ` final void`                                                                                                               | ` `[init](https://developer.android.com/reference/javax/crypto/Cipher#init(int,%20java.security.Key,%20java.security.SecureRandom))`(int opmode, `[Key](https://developer.android.com/reference/java/security/Key)` key, `[SecureRandom](https://developer.android.com/reference/java/security/SecureRandom)` random) ` Initializes this cipher with a key and a source of randomness.                                                                                                                                                                                                    | | ` final void`                                                                                                               | ` `[init](https://developer.android.com/reference/javax/crypto/Cipher#init(int,%20java.security.Key,%20java.security.spec.AlgorithmParameterSpec))`(int opmode, `[Key](https://developer.android.com/reference/java/security/Key)` key, `[AlgorithmParameterSpec](https://developer.android.com/reference/java/security/spec/AlgorithmParameterSpec)` params) ` Initializes this cipher with a key and a set of algorithm parameters.                                                                                                                                                     | | ` final void`                                                                                                               | ` `[init](https://developer.android.com/reference/javax/crypto/Cipher#init(int,%20java.security.Key))`(int opmode, `[Key](https://developer.android.com/reference/java/security/Key)` key) ` Initializes this cipher with a key.                                                                                                                                                                                                                                                                                                                                                          | | ` final void`                                                                                                               | ` `[init](https://developer.android.com/reference/javax/crypto/Cipher#init(int,%20java.security.Key,%20java.security.spec.AlgorithmParameterSpec,%20java.security.SecureRandom))`(int opmode, `[Key](https://developer.android.com/reference/java/security/Key)` key, `[AlgorithmParameterSpec](https://developer.android.com/reference/java/security/spec/AlgorithmParameterSpec)` params, `[SecureRandom](https://developer.android.com/reference/java/security/SecureRandom)` random) ` Initializes this cipher with a key, a set of algorithm parameters, and a source of randomness. | | ` final void`                                                                                                               | ` `[init](https://developer.android.com/reference/javax/crypto/Cipher#init(int,%20java.security.cert.Certificate))`(int opmode, `[Certificate](https://developer.android.com/reference/java/security/cert/Certificate)` certificate) ` Initializes this cipher with the public key from the given certificate.                                                                                                                                                                                                                                                                            | | ` final void`                                                                                                               | ` `[init](https://developer.android.com/reference/javax/crypto/Cipher#init(int,%20java.security.Key,%20java.security.AlgorithmParameters,%20java.security.SecureRandom))`(int opmode, `[Key](https://developer.android.com/reference/java/security/Key)` key, `[AlgorithmParameters](https://developer.android.com/reference/java/security/AlgorithmParameters)` params, `[SecureRandom](https://developer.android.com/reference/java/security/SecureRandom)` random) ` Initializes this cipher with a key, a set of algorithm parameters, and a source of randomness.                    | | ` final `[Key](https://developer.android.com/reference/java/security/Key)                                                   | ` `[unwrap](https://developer.android.com/reference/javax/crypto/Cipher#unwrap(byte[],%20java.lang.String,%20int))`(byte[] wrappedKey, `[String](https://developer.android.com/reference/java/lang/String)` wrappedKeyAlgorithm, int wrappedKeyType) ` Unwrap a previously wrapped key.                                                                                                                                                                                                                                                                                                   | | ` final byte[]`                                                                                                             | ` `[update](https://developer.android.com/reference/javax/crypto/Cipher#update(byte[]))`(byte[] input) ` Continues a multiple-part encryption or decryption operation (depending on how this cipher was initialized), processing another data part.                                                                                                                                                                                                                                                                                                                                       | | ` final int`                                                                                                                | ` `[update](https://developer.android.com/reference/javax/crypto/Cipher#update(byte[],%20int,%20int,%20byte[]))`(byte[] input, int inputOffset, int inputLen, byte[] output) ` Continues a multiple-part encryption or decryption operation (depending on how this cipher was initialized), processing another data part.                                                                                                                                                                                                                                                                 | | ` final byte[]`                                                                                                             | ` `[update](https://developer.android.com/reference/javax/crypto/Cipher#update(byte[],%20int,%20int))`(byte[] input, int inputOffset, int inputLen) ` Continues a multiple-part encryption or decryption operation (depending on how this cipher was initialized), processing another data part.                                                                                                                                                                                                                                                                                          | | ` final int`                                                                                                                | ` `[update](https://developer.android.com/reference/javax/crypto/Cipher#update(java.nio.ByteBuffer,%20java.nio.ByteBuffer))`(`[ByteBuffer](https://developer.android.com/reference/java/nio/ByteBuffer)` input, `[ByteBuffer](https://developer.android.com/reference/java/nio/ByteBuffer)` output) ` Continues a multiple-part encryption or decryption operation (depending on how this cipher was initialized), processing another data part.                                                                                                                                          | | ` final int`                                                                                                                | ` `[update](https://developer.android.com/reference/javax/crypto/Cipher#update(byte[],%20int,%20int,%20byte[],%20int))`(byte[] input, int inputOffset, int inputLen, byte[] output, int outputOffset) ` Continues a multiple-part encryption or decryption operation (depending on how this cipher was initialized), processing another data part.                                                                                                                                                                                                                                        | | ` final void`                                                                                                               | ` `[updateAAD](https://developer.android.com/reference/javax/crypto/Cipher#updateAAD(byte[],%20int,%20int))`(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 void`                                                                                                               | ` `[updateAAD](https://developer.android.com/reference/javax/crypto/Cipher#updateAAD(java.nio.ByteBuffer))`(`[ByteBuffer](https://developer.android.com/reference/java/nio/ByteBuffer)` src) ` Continues a multi-part update of the Additional Authentication Data (AAD).                                                                                                                                                                                                                                                                                                                 | | ` final void`                                                                                                               | ` `[updateAAD](https://developer.android.com/reference/javax/crypto/Cipher#updateAAD(byte[]))`(byte[] src) ` Continues a multi-part update of the Additional Authentication Data (AAD).                                                                                                                                                                                                                                                                                                                                                                                                   | | ` final byte[]`                                                                                                             | ` `[wrap](https://developer.android.com/reference/javax/crypto/Cipher#wrap(java.security.Key))`(`[Key](https://developer.android.com/reference/java/security/Key)` key) ` Wrap a key.                                                                                                                                                                                                                                                                                                                                                                                                     | ||
| From class` `[java.lang.Object](https://developer.android.com/reference/java/lang/Object)` ` |--------------------------------------------------------------------------------|-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------| | ` `[Object](https://developer.android.com/reference/java/lang/Object)          | ` `[clone](https://developer.android.com/reference/java/lang/Object#clone())`() ` Creates and returns a copy of this object.                                                                                                                                                      | | ` boolean`                                                                     | ` `[equals](https://developer.android.com/reference/java/lang/Object#equals(java.lang.Object))`(`[Object](https://developer.android.com/reference/java/lang/Object)` obj) ` Indicates whether some other object is "equal to" this one.                                           | | ` void`                                                                        | ` `[finalize](https://developer.android.com/reference/java/lang/Object#finalize())`() ` Called by the garbage collector on an object when garbage collection determines that there are no more references to the object.                                                          | | ` final `[Class](https://developer.android.com/reference/java/lang/Class)`<?>` | ` `[getClass](https://developer.android.com/reference/java/lang/Object#getClass())`() ` Returns the runtime class of this`Object`.                                                                                                                                                | | ` int`                                                                         | ` `[hashCode](https://developer.android.com/reference/java/lang/Object#hashCode())`() ` Returns a hash code value for the object.                                                                                                                                                 | | ` final void`                                                                  | ` `[notify](https://developer.android.com/reference/java/lang/Object#notify())`() ` Wakes up a single thread that is waiting on this object's monitor.                                                                                                                            | | ` final void`                                                                  | ` `[notifyAll](https://developer.android.com/reference/java/lang/Object#notifyAll())`() ` Wakes up all threads that are waiting on this object's monitor.                                                                                                                         | | ` `[String](https://developer.android.com/reference/java/lang/String)          | ` `[toString](https://developer.android.com/reference/java/lang/Object#toString())`() ` Returns a string representation of the object.                                                                                                                                            | | ` final void`                                                                  | ` `[wait](https://developer.android.com/reference/java/lang/Object#wait(long,%20int))`(long timeoutMillis, int nanos) ` Causes the current thread to wait until it is awakened, typically by being*notified* or*interrupted*, or until a certain amount of real time has elapsed. | | ` final void`                                                                  | ` `[wait](https://developer.android.com/reference/java/lang/Object#wait(long))`(long timeoutMillis) ` Causes the current thread to wait until it is awakened, typically by being*notified* or*interrupted*, or until a certain amount of real time has elapsed.                   | | ` final void`                                                                  | ` `[wait](https://developer.android.com/reference/java/lang/Object#wait())`() ` Causes the current thread to wait until it is awakened, typically by being*notified* or*interrupted*.                                                                                             | ||

## Public constructors

### NullCipher

Added in[API level 1](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)  

```
public NullCipher ()
```

Creates a NullCipher object.

<br />