Package org.apache.sshd.common.cipher
Interface Cipher
-
- All Superinterfaces:
AlgorithmNameProvider
,CipherInformation
,KeySizeIndicator
- All Known Implementing Classes:
BaseCipher
,BaseRC4Cipher
,CipherNone
public interface Cipher extends CipherInformation
Wrapper for a cryptographic cipher, used either for encryption or decryption.- Author:
- Apache MINA SSHD Project
-
-
Nested Class Summary
Nested Classes Modifier and Type Interface Description static class
Cipher.Mode
-
Method Summary
All Methods Static Methods Instance Methods Abstract Methods Default Methods Modifier and Type Method Description static boolean
checkSupported(String xform, int keyLength)
void
init(Cipher.Mode mode, byte[] key, byte[] iv)
Initialize the cipher for encryption or decryption with the given key and initialization vectordefault void
update(byte[] input)
Performs in-place encryption or decryption on the given data.void
update(byte[] input, int inputOffset, int inputLen)
Performs in-place encryption or decryption on the given data.-
Methods inherited from interface org.apache.sshd.common.AlgorithmNameProvider
getAlgorithm
-
Methods inherited from interface org.apache.sshd.common.cipher.CipherInformation
getCipherBlockSize, getIVSize, getKdfSize, getTransformation
-
Methods inherited from interface org.apache.sshd.common.keyprovider.KeySizeIndicator
getKeySize
-
-
-
-
Method Detail
-
init
void init(Cipher.Mode mode, byte[] key, byte[] iv) throws Exception
Initialize the cipher for encryption or decryption with the given key and initialization vector- Parameters:
mode
- Encrypt/Decrypt initializationkey
- Key bytesiv
- Initialization vector bytes- Throws:
Exception
- If failed to initialize
-
update
default void update(byte[] input) throws Exception
Performs in-place encryption or decryption on the given data.- Parameters:
input
- The input/output bytes- Throws:
Exception
- If failed to execute- See Also:
update(byte[], int, int)
-
update
void update(byte[] input, int inputOffset, int inputLen) throws Exception
Performs in-place encryption or decryption on the given data.- Parameters:
input
- The input/output bytesinputOffset
- The offset of the data in the data bufferinputLen
- The number of bytes to update - starting at the given offset- Throws:
Exception
- If failed to execute
-
checkSupported
static boolean checkSupported(String xform, int keyLength)
- Parameters:
xform
- The full cipher transformation - e.g., AES/CBC/NoPadding - nevernull
/emptykeyLength
- The required key length in bits - always positive- Returns:
true
if the cipher transformation and required key length are supported- See Also:
Cipher.getMaxAllowedKeyLength(String)
-
-