com.sshtools.j2ssh.transport.cipher
Interface SshCipher

All Known Implementing Classes:
BlowfishCbc

public interface SshCipher

Defines the interface for all SSH ciphers. Any cipher class that implements this interface can be used for encryption within the SSH protocol. Third party implementations can dynamically add new ciphers to existing J2SSH installations by inserting a CipherAlgorithm element into the SSH API configuration file ssh.xml. The algorithm name must follow the name@domain syntax.

Version:
1.0
Author:
Lee David Painter ( lee@sshtools.com )

Field Summary
static int DECRYPT_MODE
          Declares the cipher as decrypting
static int ENCRYPT_MODE
          Declares the cipher as encrypting
 
Method Summary
 int getBlockSize()
          Gets the blockSize of the cipher
 void init(int mode, byte[] iv, byte[] keydata)
           Called to initiate the cipher after construction.
 byte[] transform(byte[] data)
           Called to transform the supplied data according to the cipher mode.
 byte[] transform(byte[] data, int offset, int len)
           Called to transform the supplied data according to the cipher mode.
 

Field Detail

ENCRYPT_MODE

public static final int ENCRYPT_MODE
Declares the cipher as encrypting

See Also:
Constant Field Values

DECRYPT_MODE

public static final int DECRYPT_MODE
Declares the cipher as decrypting

See Also:
Constant Field Values
Method Detail

init

public void init(int mode,
                 byte[] iv,
                 byte[] keydata)
          throws AlgorithmOperationException

Called to initiate the cipher after construction.

Parameters:
mode - The cipher mode ENCRYPT_MODE | DECRYPT_MODE
iv - The iv data output from key exchange
keydata - The key data output from key exchange
Throws:
AlgorithmOperationException - Throw if an error occurs

transform

public byte[] transform(byte[] data)
                 throws AlgorithmOperationException

Called to transform the supplied data according to the cipher mode.

Parameters:
data - The untransformed data
Returns:
The transformed data
Throws:
AlgorithmOperationException - Throw if an error occurs

transform

public byte[] transform(byte[] data,
                        int offset,
                        int len)
                 throws AlgorithmOperationException

Called to transform the supplied data according to the cipher mode.

Parameters:
data - The untransformed data
offset - The offset to start in the data
len - The length to transform
Returns:
The transformed data
Throws:
AlgorithmOperationException - Throw if an error occurs

getBlockSize

public int getBlockSize()
Gets the blockSize of the cipher

Returns:
The blockSize value


Copyright © 2002 Sshtools.com. All Rights Reserved.