Package com.identity4j.util.crypt.impl
Class AbstractEncoder
- java.lang.Object
-
- com.identity4j.util.crypt.impl.AbstractEncoder
-
- All Implemented Interfaces:
Encoder
- Direct Known Subclasses:
AbstractPHPHashEncoder,AbstractUnixSHAEncoder,Base64Encoder,CompoundEncoder,MessageDigestEncoder,NSSEncoder,PBEWithMD5AndDESEncoder,PlainEncoder,RawAESEncoder,UnicodeEncoder,UnixBlowfishEncoder,UnixDESEncoder,UnixMD5Encoder
public abstract class AbstractEncoder extends Object implements Encoder
-
-
Constructor Summary
Constructors Constructor Description AbstractEncoder(String id)
-
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.StringgetId()Get the ID of this encoder.booleanisOfType(byte[] encodedBytes, String charset)Determine if this encoder may have been used to create the provided encoded bytes.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.protected byte[]randomBytes(int count)
-
-
-
Constructor Detail
-
AbstractEncoder
public AbstractEncoder(String id)
-
-
Method Detail
-
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- Parameters:
toDecode- bytes to decodesalt- TODOpassphrase- passphrase if supportedcharset- character set- Returns:
- decoded text
- Throws:
EncoderException- if encoding fails
-
isOfType
public boolean isOfType(byte[] encodedBytes, String charset)Description copied from interface:EncoderDetermine if this encoder may have been used to create the provided encoded bytes. This method should only be used if it is very likely to be the right encoder.
-
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.
-
randomBytes
protected byte[] randomBytes(int count)
-
-