public abstract class SshCipher extends java.lang.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(java.lang.String algorithm,
SecurityLevel securityLevel,
int priority) |
| Modifier and Type | Method and Description |
|---|---|
java.lang.String |
getAlgorithm() |
abstract int |
getBlockSize()
Get the cipher block size.
|
abstract int |
getKeyLength()
Return the key length required
|
int |
getMacLength() |
int |
getPriority() |
abstract java.lang.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(java.lang.String algorithm,
SecurityLevel securityLevel,
int priority)
public SecurityLevel getSecurityLevel()
getSecurityLevel in interface SecureComponentpublic int getPriority()
getPriority in interface SecureComponentpublic java.lang.String getAlgorithm()
getAlgorithm in interface SshComponentgetAlgorithm in interface SecureComponentpublic abstract int getBlockSize()
public abstract int getKeyLength()
public abstract void init(int mode,
byte[] iv,
byte[] keydata)
throws java.io.IOException
mode - the mode to operateiv - the initiaization vectorkeydata - the key datajava.io.IOExceptionpublic void transform(byte[] data)
throws java.io.IOException
data - java.io.IOExceptionpublic abstract void transform(byte[] src,
int start,
byte[] dest,
int offset,
int len)
throws java.io.IOException
src - start - dest - offset - len - java.io.IOExceptionpublic boolean isMAC()
public int getMacLength()
public abstract java.lang.String getProviderName()
Copyright © 2022. All rights reserved.