Package com.easydesk.crypto.provider
Class HmacCrypt
java.lang.Object
com.easydesk.crypto.provider.CleanCrypt
com.easydesk.crypto.provider.HmacCrypt
- All Implemented Interfaces:
CryptoAlgorithm
Implements the normal java PBKDF2WithHmacSHA1 stream cipers.
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionbyte[]decrypt(char[] value, byte[] salt, int iteration) byte[]encrypt(byte[] value, byte[] salt, int iteration) encrypt the supplied string with the requested cipherbyte[]encrypt(char[] chars, byte[] salt, int iteration) encrypt the supplied string with the requested cipherboolean(non-Javadoc)voidSetting the actual cipher requested.voidsetKeyLength(int length) 64 * length value of keyMethods inherited from class com.easydesk.crypto.provider.CleanCrypt
decrypt, encrypt, encrytedFullPassword, getIteration, getKey, getRandom, getSalt, isHex, isValid, isValid, setSaltSize, setSeed, toBytes, toChars
-
Constructor Details
-
HmacCrypt
public HmacCrypt()Creates a new HmacCrypt object.
-
-
Method Details
-
setCipher
Setting the actual cipher requested. If not called, then the default cipher (SHA-512) is used.- Specified by:
setCipherin interfaceCryptoAlgorithm- Overrides:
setCipherin classCleanCrypt- Parameters:
cipher- The cipher to use.
-
setKeyLength
public void setKeyLength(int length) 64 * length value of key- Specified by:
setKeyLengthin interfaceCryptoAlgorithm- Overrides:
setKeyLengthin classCleanCrypt- Parameters:
length-
-
encrypt
encrypt the supplied string with the requested cipher- Specified by:
encryptin interfaceCryptoAlgorithm- Overrides:
encryptin classCleanCrypt- Parameters:
value- The value to be encryptedsalt- can not be nulliteration- ignored- Returns:
- The encrypted value
- Throws:
Exception- An Exception of the underlying implementation.GeneralSecurityException- various errors from the underlying ciphers.
-
encrypt
encrypt the supplied string with the requested cipher- Specified by:
encryptin interfaceCryptoAlgorithm- Overrides:
encryptin classCleanCrypt- Parameters:
chars- The value to be encryptedsalt- can not be nulliteration- ignored- Returns:
- The encrypted value
- Throws:
Exception- An Exception of the underlying implementation.GeneralSecurityException- various errors from the underlying ciphers.
-
decrypt
- Specified by:
decryptin interfaceCryptoAlgorithm- Overrides:
decryptin classCleanCrypt- Parameters:
value-salt-iteration-- Returns:
- Throws:
GeneralSecurityException
-
isValid
Description copied from class:CleanCrypt(non-Javadoc)- Specified by:
isValidin interfaceCryptoAlgorithm- Overrides:
isValidin classCleanCrypt- Parameters:
test- the value to be testedstored- iteration + ":" + salt + ":" + digested- Returns:
- Throws:
GeneralSecurityException- See Also:
-