public abstract class SshCipher extends Object implements SshComponent, SecureComponent
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.
|
Constructor and Description |
---|
SshCipher(String algorithm,
SecurityLevel securityLevel) |
Modifier and Type | Method and Description |
---|---|
String |
getAlgorithm() |
abstract int |
getBlockSize()
Get the cipher block size.
|
abstract int |
getKeyLength()
Return the key length required
|
int |
getMacLength() |
int |
getPriority() |
abstract String |
getProviderName() |
SecurityLevel |
getSecurityLevel() |
abstract void |
init(int mode,
byte[] iv,
byte[] keydata)
Initialize the cipher with up to 40 bytes of iv and key data.
|
boolean |
isMAC() |
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, SecurityLevel securityLevel)
public SecurityLevel getSecurityLevel()
getSecurityLevel
in interface SecureComponent
public int getPriority()
getPriority
in interface SecureComponent
public String getAlgorithm()
getAlgorithm
in interface SshComponent
getAlgorithm
in interface SecureComponent
public abstract int getBlockSize()
public abstract int getKeyLength()
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
public boolean isMAC()
public int getMacLength()
public abstract String getProviderName()
Copyright © 2024. All rights reserved.