Package org.jastacry.layer
Class AesEcbLayer
- java.lang.Object
-
- org.jastacry.layer.AbstractBasicLayer
-
- org.jastacry.layer.AesEcbLayer
-
public class AesEcbLayer extends AbstractBasicLayer
AES Layer class.SPDX-License-Identifier: MIT
- Author:
- Kai Kretschmann
-
-
Field Summary
Fields Modifier and Type Field Description protected static int
BITSPERBYTE
How many bits in a byte.protected char[]
chPasswd
char array of password.protected int
currentKeysize
Key size as defined by child class.protected int
iterCount
Iterations count as defined by child class.protected SecretKeyFactory
keyFac
SecretKeyFactory.protected SecretKey
pbeKey
SecretKey.protected PBEKeySpec
pbeKeySpec
PBEKeySpec.protected SecretKeySpec
pbeSecretKeySpec
SecretKeySpec.protected byte[]
salt
salt.protected String
strKeyAlg
Algorithm for the key.-
Fields inherited from class org.jastacry.layer.AbstractBasicLayer
endController, inputStream, logger, outputStream
-
-
Constructor Summary
Constructors Constructor Description AesEcbLayer()
Constructor of AesLayer.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
decStream(InputStream inputStream, OutputStream outputStream)
decode Stream function.void
encodeAndDecode(InputStream inputStream, OutputStream outputStream)
Local encode Stream function which does the real thing for Random Layer.void
encStream(InputStream inputStream, OutputStream outputStream)
encode Stream function.boolean
equals(Object o)
Override equals method from object class.protected String
getMyAlg()
Abstract base method for getting algorithm name back.protected int
getMyCount()
Abstract base method for getting a counter back.protected int
getMyIvLen()
Abstract base method for getting IV length back.protected String
getMyKeyAlg()
Abstract base method for getting key algorithm name back.protected int
getMyKeysize()
Abstract base method for getting key size back.protected int
getMySaltLen()
Abstract base method for getting salt len back.int
hashCode()
Override equals method from object class.protected void
init()
Set base values via own getters, which are defined in child classes.void
init(String data)
init function.protected void
setupPbe()
Generate Keys from plain password.-
Methods inherited from class org.jastacry.layer.AbstractBasicLayer
progress, rangeCheck, readAllBytes, run, setAction, setEndController, setInputStream, setOutputStream, setRealLayerName, toString
-
-
-
-
Field Detail
-
BITSPERBYTE
protected static final int BITSPERBYTE
How many bits in a byte.- See Also:
- Constant Field Values
-
pbeKeySpec
protected PBEKeySpec pbeKeySpec
PBEKeySpec.
-
keyFac
protected SecretKeyFactory keyFac
SecretKeyFactory.
-
pbeKey
protected SecretKey pbeKey
SecretKey.
-
pbeSecretKeySpec
protected SecretKeySpec pbeSecretKeySpec
SecretKeySpec.
-
strKeyAlg
protected String strKeyAlg
Algorithm for the key.
-
chPasswd
protected char[] chPasswd
char array of password.
-
iterCount
protected int iterCount
Iterations count as defined by child class.
-
currentKeysize
protected int currentKeysize
Key size as defined by child class.
-
salt
protected byte[] salt
salt.
-
-
Method Detail
-
setupPbe
protected final void setupPbe() throws JastacryException
Generate Keys from plain password.- Throws:
JastacryException
- on error
-
init
public final void init(String data)
init function. Overrides base init but uses it for setting base values.- Parameters:
data
- to initialize the crypt value.
-
getMyAlg
protected final String getMyAlg()
Abstract base method for getting algorithm name back.- Returns:
- String
-
getMyKeyAlg
protected final String getMyKeyAlg()
Abstract base method for getting key algorithm name back.- Returns:
- String
-
getMySaltLen
protected int getMySaltLen()
Abstract base method for getting salt len back.- Returns:
- int length
-
getMyIvLen
protected int getMyIvLen()
Abstract base method for getting IV length back.- Returns:
- int length
-
getMyCount
protected int getMyCount()
Abstract base method for getting a counter back.- Returns:
- int
-
getMyKeysize
protected int getMyKeysize()
Abstract base method for getting key size back.- Returns:
- int length
-
equals
public boolean equals(Object o)
Override equals method from object class.
-
hashCode
public int hashCode()
Override equals method from object class.
-
init
protected final void init()
Set base values via own getters, which are defined in child classes.
-
encStream
public final void encStream(InputStream inputStream, OutputStream outputStream) throws JastacryException
encode Stream function.- Parameters:
inputStream
- incoming dataoutputStream
- outgoing data- Throws:
JastacryException
- thrown on error
-
decStream
public final void decStream(InputStream inputStream, OutputStream outputStream) throws JastacryException
decode Stream function.- Parameters:
inputStream
- incoming dataoutputStream
- outgoing data- Throws:
JastacryException
- thrown on error
-
encodeAndDecode
public final void encodeAndDecode(InputStream inputStream, OutputStream outputStream) throws JastacryException
Description copied from interface:Layer
Local encode Stream function which does the real thing for Random Layer.- Parameters:
inputStream
- incoming dataoutputStream
- outgoing data- Throws:
JastacryException
- thrown on error
-
-