Package com.identity4j.util.crypt
Interface Encoder
-
- All Known Implementing Classes:
AbstractEncoder,AbstractPHPHashEncoder,AbstractUnixSHAEncoder,AES192Encoder,AES256Encoder,AESEncoder,Base64AES192Encoder,Base64AES256Encoder,Base64AESEncoder,Base64Encoder,Base64FIPSEncoder,Base64NSSEncoder,Base64PBEWithMD5AndDESEncoder,CompoundEncoder,Drupal7Encoder,FIPSEncoder,MD5Base64Encoder,MD5Encoder,MD5StringEncoder,MessageDigestEncoder,MessageDigestStringEncoder,NSSEncoder,PBEWithMD5AndDESEncoder,PlainEncoder,RawAESEncoder,SHABase64Encoder,SHAEncoder,SHAStringEncoder,UnicodeEncoder,UnixBlowfishEncoder,UnixDESEncoder,UnixMD5Encoder,UnixSHA256Encoder,UnixSHA512Encoder
public interface EncoderThere are many methods of converting passwords and other confidential information for storage. This interfaces is to be implemented by classes that may be used to encode some text into a byte array, and optionally back again.
-
-
Method Summary
All Methods Instance Methods Abstract 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 stringStringgetId()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.
-
-
-
Method Detail
-
getId
String getId()
Get the ID of this encoder.- Returns:
- id
-
isOfType
boolean isOfType(byte[] encodedBytes, String charset)Determine 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.- Parameters:
encodedBytes- encoded bytescharset- character set- Returns:
- this almost certainly was encoded with a similar encoder
-
encode
byte[] encode(byte[] toEncode, byte[] salt, byte[] passphrase, String charset) throws EncoderExceptionEncode a string- Parameters:
toEncode- data to encodesalt- salt if supportedpassphrase- passphrase if supportedcharset- character set- Returns:
- encoded bytes
- Throws:
EncoderException- if encoding fails
-
decode
byte[] decode(byte[] toDecode, byte[] salt, byte[] passphrase, String charset) throws EncoderExceptionDecode bytes (if supported) to text.- Parameters:
toDecode- bytes to decodesalt- TODOpassphrase- passphrase if supportedcharset- character set- Returns:
- decoded text
- Throws:
EncoderException- if encoding failsUnsupportedOperationException
-
match
boolean match(byte[] encodedData, byte[] unencodedData, byte[] passphrase, String charset)Check if the provide un-encoded data would match the encoded data if it was encoded.- Parameters:
encodedData- encoded dataunencodedData- un-encoded datapassphrase- passphrase if supportedcharset- character set- Returns:
- matches
-
-