Class AbstractJCECipher
java.lang.Object
com.sshtools.common.ssh.components.AbstractSshCipher
com.sshtools.common.ssh.components.jce.AbstractJCECipher
- All Implemented Interfaces:
Component,SshCipher,SshComponent,SecureComponent
- Direct Known Subclasses:
AES128Cbc,AES128Ctr,AES128Gcm,AES192Cbc,AES192Ctr,AES256Cbc,AES256Ctr,AES256Gcm,ArcFour,ArcFour128,ArcFour256,BlowfishCbc,TripleDesCbc,TripleDesCtr
An abstract base class for defining SSH ciphers which use a JCE provider instead of the internal Maverick Crypto provider.
- Author:
- Lee David Painter
-
Field Summary
Fields inherited from interface com.sshtools.common.ssh.components.SshCipher
DECRYPT_MODE, ENCRYPT_MODE -
Constructor Summary
ConstructorsConstructorDescriptionAbstractJCECipher(String spec, String keyspec, int keylength, String algorithm, SecurityLevel securityLevel, int priority) -
Method Summary
Modifier and TypeMethodDescriptionprotected CiphercreateCipher(String spec) intGet the cipher block size.intReturn the key length requiredvoidinit(int mode, byte[] iv, byte[] keydata) Initialize the cipher with up to 40 bytes of iv and key data.voidtransform(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.Methods inherited from class com.sshtools.common.ssh.components.AbstractSshCipher
getAlgorithm, getMacLength, getPriority, getSecurityLevel, isMAC, transform
-
Constructor Details
-
AbstractJCECipher
public AbstractJCECipher(String spec, String keyspec, int keylength, String algorithm, SecurityLevel securityLevel, int priority) throws IOException - Parameters:
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 key- Throws:
IOException
-
-
Method Details
-
getProviderName
- Specified by:
getProviderNamein interfaceSshCipher- Specified by:
getProviderNamein classAbstractSshCipher
-
createCipher
-
transform
Description copied from class:AbstractSshCipherTransform 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.- Specified by:
transformin interfaceSshCipher- Specified by:
transformin classAbstractSshCipher- Throws:
IOException
-
getProvider
-
getKeyLength
public int getKeyLength()Description copied from class:AbstractSshCipherReturn the key length required- Specified by:
getKeyLengthin interfaceSshCipher- Specified by:
getKeyLengthin classAbstractSshCipher- Returns:
-
init
Description copied from class:AbstractSshCipherInitialize the cipher with up to 40 bytes of iv and key data. Each implementation should take as much data from the initialization as it needs ignoring any data that it does not require.- Specified by:
initin interfaceSshCipher- Specified by:
initin classAbstractSshCipher- Parameters:
mode- the mode to operateiv- the initiaization vectorkeydata- the key data- Throws:
IOException
-
getBlockSize
public int getBlockSize()Description copied from class:AbstractSshCipherGet the cipher block size.- Specified by:
getBlockSizein interfaceSshCipher- Specified by:
getBlockSizein classAbstractSshCipher- Returns:
- the block size in bytes.
-