public class AbstractJCECipher extends SshCipher
An abstract base class for defining SSH ciphers which use a JCE provider instead of the internal Maverick Crypto provider.
DECRYPT_MODE, ENCRYPT_MODE
Constructor and Description |
---|
AbstractJCECipher(String spec,
String keyspec,
int keylength,
String algorithm,
SecurityLevel securityLevel) |
Modifier and Type | Method and Description |
---|---|
protected Cipher |
createCipher(String spec) |
protected AlgorithmParameterSpec |
generateAlgorithmSpec(byte[] iv) |
protected SecretKeySpec |
generateSecretKeySpec(byte[] actualKey) |
int |
getBlockSize()
Get the cipher block size.
|
int |
getKeyLength()
Return the key length required
|
String |
getProvider() |
String |
getProviderName() |
void |
init(int mode,
byte[] iv,
byte[] keydata)
Initialize the cipher with up to 40 bytes of iv and key data.
|
void |
transform(byte[] buf,
int start,
byte[] output,
int off,
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.
|
getAlgorithm, getMacLength, getPriority, getSecurityLevel, isMAC, transform
public AbstractJCECipher(String spec, String keyspec, int keylength, String algorithm, SecurityLevel securityLevel) throws IOException
spec
- the value passed into Cipher.getInstance() that specifies the
specification of the cipher; for example "Blowfish/CBC/NoPadding"keyspec
- the value passed into the constructor of SecretKeySpec.keylength
- int the length in bytes of the keyIOException
public String getProviderName()
getProviderName
in class SshCipher
protected Cipher createCipher(String spec) throws NoSuchAlgorithmException, NoSuchPaddingException
public void transform(byte[] buf, int start, byte[] output, int off, int len) throws IOException
SshCipher
transform
in class SshCipher
IOException
public String getProvider()
public int getKeyLength()
SshCipher
getKeyLength
in class SshCipher
public void init(int mode, byte[] iv, byte[] keydata) throws IOException
SshCipher
init
in class SshCipher
mode
- the mode to operateiv
- the initiaization vectorkeydata
- the key dataIOException
protected AlgorithmParameterSpec generateAlgorithmSpec(byte[] iv)
protected SecretKeySpec generateSecretKeySpec(byte[] actualKey)
public int getBlockSize()
SshCipher
getBlockSize
in class SshCipher
Copyright © 2024. All rights reserved.