Save This Page
Home » openjdk-7 » com.sun.crypto » provider » [javadoc | source]
com.sun.crypto.provider
final class: CipherTextStealing [javadoc | source]
java.lang.Object
   com.sun.crypto.provider.FeedbackCipher
      com.sun.crypto.provider.CipherBlockChaining
         com.sun.crypto.provider.CipherTextStealing
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#1: 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#2: This class does not deal with buffering or padding just like all other cipher mode implementations.

Fields inherited from com.sun.crypto.provider.CipherBlockChaining:
r
Fields inherited from com.sun.crypto.provider.FeedbackCipher:
embeddedCipher,  blockSize,  iv
Constructor:
 CipherTextStealing(SymmetricCipher embeddedCipher) 
Method from com.sun.crypto.provider.CipherTextStealing Summary:
decryptFinal,   encryptFinal,   getFeedback
Methods from com.sun.crypto.provider.CipherBlockChaining:
decrypt,   encrypt,   getFeedback,   init,   reset,   restore,   save
Methods from com.sun.crypto.provider.FeedbackCipher:
decrypt,   decryptFinal,   encrypt,   encryptFinal,   getBlockSize,   getEmbeddedCipher,   getFeedback,   getIV,   init,   reset,   restore,   save
Methods from java.lang.Object:
clone,   equals,   finalize,   getClass,   hashCode,   notify,   notifyAll,   toString,   wait,   wait,   wait
Method from com.sun.crypto.provider.CipherTextStealing Detail:
  void decryptFinal(byte[] cipher,
    int cipherOffset,
    int cipherLen,
    byte[] plain,
    int plainOffset) throws IllegalBlockSizeException 
    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.)

  void encryptFinal(byte[] plain,
    int plainOffset,
    int plainLen,
    byte[] cipher,
    int cipherOffset) throws IllegalBlockSizeException 
    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.

 String getFeedback() 
    Gets the name of this feedback mode.