Package com.identity4j.util.crypt.impl
Class RawAESEncoder
- java.lang.Object
-
- com.identity4j.util.crypt.impl.AbstractEncoder
-
- com.identity4j.util.crypt.impl.RawAESEncoder
-
- All Implemented Interfaces:
Encoder
- Direct Known Subclasses:
AESEncoder
public class RawAESEncoder extends AbstractEncoder
-
-
Constructor Summary
Constructors Constructor Description RawAESEncoder()RawAESEncoder(int keyLength)RawAESEncoder(String id)RawAESEncoder(String id, int keyLength)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected byte[]checkSaltLength(byte[] salt, Cipher cipher)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)protected SecretKeygetSecretKey(char[] password, byte[] salt, int keyLength, int iterations)-
Methods inherited from class com.identity4j.util.crypt.impl.AbstractEncoder
getId, isOfType, match, randomBytes
-
-
-
-
Field Detail
-
ID
public static final String ID
- See Also:
- Constant Field Values
-
keyLength
protected int keyLength
-
-
Method Detail
-
getSecretKey
protected SecretKey getSecretKey(char[] password, byte[] salt, int keyLength, int iterations) throws NoSuchAlgorithmException, InvalidKeySpecException
-
encode
public byte[] encode(byte[] toEncode, byte[] salt, byte[] passphrase, String charset) throws EncoderExceptionDescription copied from interface:EncoderEncode a string- 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- Throws:
EncoderException
-
checkSaltLength
protected byte[] checkSaltLength(byte[] salt, Cipher cipher)
-
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 classAbstractEncoder- Parameters:
toDecode- bytes to decodesalt- TODOpassphrase- passphrase if supportedcharset- character set- Returns:
- decoded text
- Throws:
EncoderException- if encoding fails
-
-