Class BaseCipher
- java.lang.Object
-
- net.schmizz.sshj.transport.cipher.BaseCipher
-
- All Implemented Interfaces:
Cipher
- Direct Known Subclasses:
BlockCipher,StreamCipher
public abstract class BaseCipher extends java.lang.Object implements Cipher
Base class for all Cipher implementations delegating to the JCE provider.
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from interface net.schmizz.sshj.transport.cipher.Cipher
Cipher.Mode
-
-
Constructor Summary
Constructors Constructor Description BaseCipher(int ivsize, int bsize, java.lang.String algorithm, java.lang.String transformation)
-
Method Summary
Modifier and Type Method Description intgetBlockSize()intgetIVSize()protected javax.crypto.spec.SecretKeySpecgetKeySpec(byte[] key)protected intgetMode(Cipher.Mode mode)voidinit(Cipher.Mode mode, byte[] key, byte[] iv)Initialize the cipher for encryption or decryption with the given private key and initialization vectorprotected abstract voidinitCipher(javax.crypto.Cipher cipher, Cipher.Mode mode, byte[] key, byte[] iv)voidupdate(byte[] input, int inputOffset, int inputLen)Performs in-place encryption or decryption on the given data.
-
-
-
Method Detail
-
getBlockSize
public int getBlockSize()
- Specified by:
getBlockSizein interfaceCipher- Returns:
- the block size for this cipher
-
getIVSize
public int getIVSize()
-
init
public void init(Cipher.Mode mode, byte[] key, byte[] iv)
Description copied from interface:CipherInitialize the cipher for encryption or decryption with the given private key and initialization vector
-
initCipher
protected abstract void initCipher(javax.crypto.Cipher cipher, Cipher.Mode mode, byte[] key, byte[] iv) throws java.security.InvalidKeyException, java.security.InvalidAlgorithmParameterException- Throws:
java.security.InvalidKeyExceptionjava.security.InvalidAlgorithmParameterException
-
getKeySpec
protected javax.crypto.spec.SecretKeySpec getKeySpec(byte[] key)
-
getMode
protected int getMode(Cipher.Mode mode)
-
update
public void update(byte[] input, int inputOffset, int inputLen)Description copied from interface:CipherPerforms in-place encryption or decryption on the given data.
-
-