Interface ICTRTransformer

    • Method Summary

      All Methods Instance Methods Abstract Methods 
      Modifier and Type Method Description
      int decryptData​(byte[] srcBuffer, int srcOffset, byte[] destBuffer, int destOffset, int count)
      Decrypt the data.
      int encryptData​(byte[] srcBuffer, int srcOffset, byte[] destBuffer, int destOffset, int count)
      Encrypt the data.
      long getBlock()
      Get the current block.
      byte[] getCounter()
      Get the current counter.
      byte[] getKey()
      Get the current encryption key.
      byte[] getNonce()
      Get the nonce (initial counter) to be used for the data.
      void init​(byte[] key, byte[] nonce)
      Initialize the transformer.
      void resetCounter()
      Reset the counter to the nonce (initial counter).
      void syncCounter​(long position)
      Calculate the value of the counter based on the current block.
    • Method Detail

      • init

        void init​(byte[] key,
                  byte[] nonce)
        Initialize the transformer.
        Parameters:
        key - The AES key to use.
        nonce - The nonce to use.
        Throws:
        SecurityException - Thrown if there is a security exception
      • encryptData

        int encryptData​(byte[] srcBuffer,
                        int srcOffset,
                        byte[] destBuffer,
                        int destOffset,
                        int count)
        Encrypt the data.
        Parameters:
        srcBuffer - The source byte array.
        srcOffset - The source byte offset.
        destBuffer - The destination byte array.
        destOffset - The destination byte offset.
        count - The number of bytes to transform.
        Returns:
        The number of bytes transformed.
        Throws:
        SecurityException - Thrown if there is a security exception
        RangeExceededException - Thrown if the nonce exceeds its range
      • decryptData

        int decryptData​(byte[] srcBuffer,
                        int srcOffset,
                        byte[] destBuffer,
                        int destOffset,
                        int count)
        Decrypt the data.
        Parameters:
        srcBuffer - The source byte array.
        srcOffset - The source byte offset.
        destBuffer - The destination byte array.
        destOffset - The destination byte offset.
        count - The number of bytes to transform.
        Returns:
        The number of bytes transformed.
        Throws:
        SecurityException - Thrown if there is a security exception
        RangeExceededException - Thrown if the nonce exceeds its range
      • getCounter

        byte[] getCounter()
        Get the current counter.
        Returns:
        The counter
      • getKey

        byte[] getKey()
        Get the current encryption key.
        Returns:
        The key
      • getBlock

        long getBlock()
        Get the current block.
        Returns:
        The block
      • getNonce

        byte[] getNonce()
        Get the nonce (initial counter) to be used for the data.
        Returns:
        The nonce
      • resetCounter

        void resetCounter()
        Reset the counter to the nonce (initial counter).
      • syncCounter

        void syncCounter​(long position)
        Calculate the value of the counter based on the current block. After an encryption operation (ie sync or read) the block will be incremented. This method calculates the Counter.
        Parameters:
        position - The position to sync the counter to
        Throws:
        RangeExceededException - Thrown if the nonce exceeds its range