Package com.identity4j.util.crypt.impl
Class AESEncoder
- java.lang.Object
-
- com.identity4j.util.crypt.impl.AbstractEncoder
-
- com.identity4j.util.crypt.impl.RawAESEncoder
-
- com.identity4j.util.crypt.impl.AESEncoder
-
- All Implemented Interfaces:
Encoder
- Direct Known Subclasses:
AES192Encoder,AES256Encoder
public class AESEncoder extends RawAESEncoder
-
-
Field Summary
Fields Modifier and Type Field Description static StringID-
Fields inherited from class com.identity4j.util.crypt.impl.RawAESEncoder
keyLength
-
-
Constructor Summary
Constructors Constructor Description AESEncoder()AESEncoder(String id, int keyLength)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description byte[]decode(byte[] toDecode, byte[] salt, byte[] passphrase, String charset)Decode bytes (if supported) to text.byte[]encode(byte[] toEncode, byte[] salt, byte[] passphrase, String charset)Encode a stringprotected byte[]encode(byte[] toEncode, byte[] salt, byte[] passphrase, String charset, int keyLength, int iterations)intgetIterations()booleanmatch(byte[] encodedData, byte[] unencodedData, byte[] passphrase, String charset)Check if the provide un-encoded data would match the encoded data if it was encoded.voidsetIterations(int iterations)-
Methods inherited from class com.identity4j.util.crypt.impl.RawAESEncoder
checkSaltLength, getSecretKey
-
Methods inherited from class com.identity4j.util.crypt.impl.AbstractEncoder
getId, isOfType, randomBytes
-
-
-
-
Field Detail
-
ID
public static final String ID
- See Also:
- Constant Field Values
-
-
Constructor Detail
-
AESEncoder
public AESEncoder()
-
AESEncoder
public AESEncoder(String id, int keyLength)
-
-
Method Detail
-
getIterations
public int getIterations()
-
setIterations
public void setIterations(int iterations)
-
encode
public byte[] encode(byte[] toEncode, byte[] salt, byte[] passphrase, String charset) throws EncoderExceptionDescription copied from interface:EncoderEncode a string- Specified by:
encodein interfaceEncoder- Overrides:
encodein classRawAESEncoder- Parameters:
toEncode- data to encodesalt- salt if supportedpassphrase- passphrase if supportedcharset- character set- Returns:
- encoded bytes
- Throws:
EncoderException- if encoding fails
-
encode
protected byte[] encode(byte[] toEncode, byte[] salt, byte[] passphrase, String charset, int keyLength, int iterations) throws EncoderException- Overrides:
encodein classRawAESEncoder- Throws:
EncoderException
-
decode
public byte[] decode(byte[] toDecode, byte[] salt, byte[] passphrase, String charset) throws EncoderExceptionDescription copied from interface:EncoderDecode bytes (if supported) to text.- Specified by:
decodein interfaceEncoder- Overrides:
decodein classRawAESEncoder- Parameters:
toDecode- bytes to decodesalt- TODOpassphrase- passphrase if supportedcharset- character set- Returns:
- decoded text
- Throws:
EncoderException- if encoding fails
-
match
public boolean match(byte[] encodedData, byte[] unencodedData, byte[] passphrase, String charset)Description copied from interface:EncoderCheck if the provide un-encoded data would match the encoded data if it was encoded.- Specified by:
matchin interfaceEncoder- Overrides:
matchin classAbstractEncoder- Parameters:
encodedData- encoded dataunencodedData- un-encoded datapassphrase- passphrase if supportedcharset- character set- Returns:
- matches
-
-