Home | History | Annotate | Download | only in crypto
      1 package org.bouncycastle.crypto;
      2 
      3 /**
      4  * Ciphers producing a key stream which can be reset to particular points in the stream implement this.
      5  */
      6 public interface SkippingCipher
      7 {
      8     /**
      9      * Skip numberOfBytes forwards, or backwards.
     10      *
     11      * @param numberOfBytes the number of bytes to skip (positive forward, negative backwards).
     12      * @return the number of bytes actually skipped.
     13      * @throws java.lang.IllegalArgumentException if numberOfBytes is an invalid value.
     14      */
     15     long skip(long numberOfBytes);
     16 
     17     /**
     18      * Reset the cipher and then skip forward to a given position.
     19      *
     20      * @param position the number of bytes in to set the cipher state to.
     21      * @return the byte position moved to.
     22      */
     23     long seekTo(long position);
     24 
     25     /**
     26      * Return the current "position" of the cipher
     27      *
     28      * @return the current byte position.
     29      */
     30     long getPosition();
     31 }
     32