APIdia Launch Partner
Top Description Fields Constructors Methods
com.sun.crypto.provider

pack-priv final Class CipherTextStealing

extends CipherBlockChaining
Class Inheritance
Imports
javax.crypto.IllegalBlockSizeException

This class represents ciphers in cipher text stealing (CTS) mode.
CTS provides a way to allow block ciphers to operate on partial blocks without padding, and all bits of the message go through the encryption algorithm, rather than simply being XOR'd.
More details can be found in RFC 2040 section 8 "Description of RC5-CTS".

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

CTS requires the input data to be at least one block long. Thus, callers of this class has to buffer the input data to make sure the input data passed to encryptFinal()/decryptFinal() is not shorter than a block.

Note

This class does not deal with buffering or padding just like all other cipher mode implementations.

Author
Valerie Peng

Field Summary

Inherited from com.sun.crypto.provider.CipherBlockChaining:
r

Constructor Summary

AccessConstructor and Description
pack-priv

Method Summary

Modifier and TypeMethod and Description
pack-priv int

Returns:

the number of bytes placed into plain
decryptFinal
(byte[]
the buffer with the input data to be decrypted
cipher
,
int
the offset in cipherOffset
cipherOffset
,
int
the length of the input data
cipherLen
,
byte[]
the buffer for the result
plain
,
int
the offset in plain
plainOffset
)

Overrides com.sun.crypto.provider.FeedbackCipher.decryptFinal.

Performs decryption operation.

pack-priv int

Returns:

the number of bytes placed into cipher
encryptFinal
(byte[]
the buffer with the input data to be encrypted
plain
,
int
the offset in plain
plainOffset
,
int
the length of the input data
plainLen
,
byte[]
the buffer for the result
cipher
,
int
the offset in cipher
cipherOffset
)

Overrides com.sun.crypto.provider.FeedbackCipher.encryptFinal.

Performs the last encryption operation.

pack-priv String

Returns:

the string CBC
getFeedback
()

Overrides com.sun.crypto.provider.CipherBlockChaining.getFeedback.

Gets the name of this feedback mode.

Inherited from com.sun.crypto.provider.CipherBlockChaining:
decryptencryptinitresetrestoresave

Constructor Detail

CipherTextStealingback to summary
pack-priv CipherTextStealing(SymmetricCipher embeddedCipher)

Method Detail

decryptFinalback to summary
pack-priv int decryptFinal(byte[] cipher, int cipherOffset, int cipherLen, byte[] plain, int plainOffset) throws IllegalBlockSizeException

Overrides com.sun.crypto.provider.FeedbackCipher.decryptFinal.

Performs decryption operation.

The input cipher text cipher, starting at cipherOffset and ending at (cipherOffset + len - 1), is decrypted. The result is stored in plain, starting at plainOffset.

It is the application's responsibility to make sure that cipherLen is a multiple of the embedded cipher's block size, as any excess bytes are ignored.

It is also the application's responsibility to make sure that init has been called before this method is called. (This check is omitted here, to avoid double-checking.)

Parameters
cipher:byte[]

the buffer with the input data to be decrypted

cipherOffset:int

the offset in cipherOffset

cipherLen:int

the length of the input data

plain:byte[]

the buffer for the result

plainOffset:int

the offset in plain

Returns:int

the number of bytes placed into plain

encryptFinalback to summary
pack-priv int encryptFinal(byte[] plain, int plainOffset, int plainLen, byte[] cipher, int cipherOffset) throws IllegalBlockSizeException

Overrides com.sun.crypto.provider.FeedbackCipher.encryptFinal.

Performs the last encryption operation.

The input plain text plain, starting at plainOffset and ending at (plainOffset + len - 1), is encrypted. The result is stored in cipher, starting at cipherOffset.

It is the application's responsibility to make sure that plainLen is a multiple of the embedded cipher's block size, as any excess bytes are ignored.

Parameters
plain:byte[]

the buffer with the input data to be encrypted

plainOffset:int

the offset in plain

plainLen:int

the length of the input data

cipher:byte[]

the buffer for the result

cipherOffset:int

the offset in cipher

Returns:int

the number of bytes placed into cipher

getFeedbackback to summary
pack-priv String getFeedback()

Overrides com.sun.crypto.provider.CipherBlockChaining.getFeedback.

Gets the name of this feedback mode.

Returns:String

the string CBC