Save This Page
Home » openjdk-7 » com.sun.crypto » provider » [javadoc | source]
com.sun.crypto.provider
final class: CounterMode [javadoc | source]
java.lang.Object
   com.sun.crypto.provider.FeedbackCipher
      com.sun.crypto.provider.CounterMode
This class represents ciphers in counter (CTR) mode.

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.

Fields inherited from com.sun.crypto.provider.FeedbackCipher:
embeddedCipher,  blockSize,  iv
Constructor:
 CounterMode(SymmetricCipher embeddedCipher) 
Method from com.sun.crypto.provider.CounterMode Summary:
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.CounterMode Detail:
  void decrypt(byte[] in,
    int inOff,
    int len,
    byte[] out,
    int outOff) 
    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 encrypt(byte[] in,
    int inOff,
    int len,
    byte[] out,
    int outOff) 
    Performs 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.

    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.)

 String getFeedback() 
    Gets the name of the feedback mechanism
  void init(boolean decrypting,
    String algorithm,
    byte[] key,
    byte[] iv) throws InvalidKeyException 
    Initializes the cipher in the specified mode with the given key and iv.
  void reset() 
    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).
  void restore() 
    Restores the content of this cipher to the previous saved one.
  void save() 
    Save the current content of this cipher.