This mode is implemented independently of a particular cipher. Ciphers to which this mode should apply (e.g., DES) must be plugged-in using the constructor.
Note
This class does not deal with buffering or padding.
| Modifier and Type | Field and Description |
|---|---|
| private final int | |
| pack-priv final byte[] | |
| private byte[] | |
| private final byte[] | |
| private byte[] | |
| private int | |
| private int |
| Access | Constructor and Description |
|---|---|
| pack-priv |
| Modifier and Type | Method and Description |
|---|---|
| private int | crypt(byte[] in, int inOff, int len, byte[] out, int outOff)
Do the actual encryption/decryption operation. |
| pack-priv int | decrypt(byte[] in, int inOff, int len, byte[] out, int outOff)
Implements abstract com. Performs decryption operation. |
| pack-priv int | Returns: the length of the encrypted datathe buffer with the input data to be encrypted in, int the offset in inOff, int plainthe length of the input data len, byte[] the buffer for the result out, int the offset in outOff)cipherImplements abstract com. Performs encryption operation. |
| pack-priv String | Returns: the name of the feedback mechanismImplements abstract com. Gets the name of the feedback mechanism |
| private int | |
| private static void | |
| pack-priv void | init(boolean
flag indicating encryption or decryption decrypting, String the algorithm name algorithm, byte[] the key key, byte[] the iv iv)Implements abstract com. Initializes the cipher in the specified mode with the given key and iv. |
| pack-priv void | reset()
Implements abstract com. Resets the iv to its original value. |
| pack-priv void | restore()
Implements abstract com. Restores the content of this cipher to the previous saved one. |
| pack-priv void | save()
Implements abstract com. Save the current content of this cipher. |
| chunkSize | back to summary |
|---|---|
| private final int chunkSize | |
| counter | back to summary |
|---|---|
| pack-priv final byte[] counter | |
| counterSave | back to summary |
|---|---|
| private byte[] counterSave | |
| encryptedCounter | back to summary |
|---|---|
| private final byte[] encryptedCounter | |
| encryptedCounterSave | back to summary |
|---|---|
| private byte[] encryptedCounterSave | |
| used | back to summary |
|---|---|
| private int used | |
| usedSave | back to summary |
|---|---|
| private int usedSave | |
| CounterMode | back to summary |
|---|---|
| pack-priv CounterMode(SymmetricCipher embeddedCipher) | |
| crypt | back to summary |
|---|---|
| private int crypt(byte[] in, int inOff, int len, byte[] out, int outOff) Do the actual encryption/decryption operation. Essentially we XOR the input plaintext/ciphertext stream with a keystream generated by encrypting the counter values. Counter values are encrypted on demand. | |
| decrypt | back to summary |
|---|---|
| pack-priv int decrypt(byte[] in, int inOff, int len, byte[] out, int outOff) Implements abstract com. Doc from com. Performs decryption operation. The input The subclass that implements Cipher should ensure that
| |
| encrypt | back to summary |
|---|---|
| pack-priv int encrypt(byte[] in, int inOff, int len, byte[] out, int outOff) Implements abstract com. Performs encryption operation. The input plain text
| |
| getFeedback | back to summary |
|---|---|
| pack-priv String getFeedback() Implements abstract com. Gets the name of the feedback mechanism
| |
| implCrypt | back to summary |
|---|---|
private int implCrypt(byte[] in, int inOff, int len, byte[] out, int outOff)
| |
| increment | back to summary |
|---|---|
| private static void increment(byte[] b) Increment the counter value. | |
| init | back to summary |
|---|---|
| pack-priv void init(boolean decrypting, String algorithm, byte[] key, byte[] iv) throws InvalidKeyException Implements abstract com. Initializes the cipher in the specified mode with the given key and iv.
| |
| reset | back to summary |
|---|---|
| pack-priv void reset() Implements abstract com. Resets the iv to its original value. This is used when doFinal is called in the Cipher class, so that the cipher can be reused (with its original iv). | |
| restore | back to summary |
|---|---|
| pack-priv void restore() Implements abstract com. Restores the content of this cipher to the previous saved one. | |
| save | back to summary |
|---|---|
| pack-priv void save() Implements abstract com. Save the current content of this cipher. | |