public abstract class SshCipher extends Object
Base class for all SSH protocol ciphers. The cipher itself has 2 modes, encryption or decrpytion. The same method is used to transporm the data depending upon the mode.
Modifier and Type | Field and Description |
---|---|
static int |
DECRYPT_MODE
Decryption mode.
|
static int |
ENCRYPT_MODE
Encryption mode.
|
Modifier and Type | Method and Description |
---|---|
String |
getAlgorithm() |
abstract int |
getBlockSize()
Get the cipher block size.
|
abstract void |
init(int mode,
byte[] iv,
byte[] keydata)
Initialize the cipher with up to 40 bytes of iv and key data.
|
void |
transform(byte[] data)
Transform the byte array according to the cipher mode.
|
abstract void |
transform(byte[] src,
int start,
byte[] dest,
int offset,
int len)
Transform the byte array according to the cipher mode; it is legal for
the source and destination arrays to reference the same physical array so
care should be taken in the transformation process to safeguard this
rule.
|
public static final int ENCRYPT_MODE
public static final int DECRYPT_MODE
public SshCipher(String algorithm)
public String getAlgorithm()
public abstract int getBlockSize()
public abstract void init(int mode, byte[] iv, byte[] keydata) throws IOException
mode
- the mode to operateiv
- the initiaization vectorkeydata
- the key dataIOException
public void transform(byte[] data) throws IOException
data
- IOException
public abstract void transform(byte[] src, int start, byte[] dest, int offset, int len) throws IOException
src
- start
- dest
- offset
- len
- IOException
Copyright © 2014. All rights reserved.