net.schmizz.sshj.transport.cipher
Class BaseCipher

java.lang.Object
  extended by net.schmizz.sshj.transport.cipher.BaseCipher
All Implemented Interfaces:
Cipher
Direct Known Subclasses:
AES128CBC, AES128CTR, AES192CBC, AES192CTR, AES256CBC, AES256CTR, BlowfishCBC, TripleDESCBC

public class BaseCipher
extends Object
implements Cipher

Base class for all Cipher implementations delegating to the JCE provider.


Nested Class Summary
 
Nested classes/interfaces inherited from interface net.schmizz.sshj.transport.cipher.Cipher
Cipher.Mode
 
Constructor Summary
BaseCipher(int ivsize, int bsize, String algorithm, String transformation)
           
 
Method Summary
 int getBlockSize()
           
 int getIVSize()
           
 void init(Cipher.Mode mode, byte[] key, byte[] iv)
          Initialize the cipher for encryption or decryption with the given private key and initialization vector
 void update(byte[] input, int inputOffset, int inputLen)
          Performs in-place encryption or decryption on the given data.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

BaseCipher

public BaseCipher(int ivsize,
                  int bsize,
                  String algorithm,
                  String transformation)
Method Detail

getBlockSize

public int getBlockSize()
Specified by:
getBlockSize in interface Cipher
Returns:
the block size for this cipher

getIVSize

public int getIVSize()
Specified by:
getIVSize in interface Cipher
Returns:
the size of the initialization vector

init

public void init(Cipher.Mode mode,
                 byte[] key,
                 byte[] iv)
Description copied from interface: Cipher
Initialize the cipher for encryption or decryption with the given private key and initialization vector

Specified by:
init in interface Cipher
Parameters:
mode - whether this instance wil encrypt or decrypt
key - the key for the cipher
iv - initialization vector

update

public void update(byte[] input,
                   int inputOffset,
                   int inputLen)
Description copied from interface: Cipher
Performs in-place encryption or decryption on the given data.

Specified by:
update in interface Cipher
Parameters:
input - the subject
inputOffset - offset at which to start
inputLen - number of bytes starting at inputOffset


Copyright © 2009-2012. All Rights Reserved.