Module io.github.mmm.crypto
Class SymmetricKeySpecFactoryImplPbe
- java.lang.Object
-
- io.github.mmm.crypto.symmetric.key.spec.SymmetricKeySpecFactoryImplPbe
-
- All Implemented Interfaces:
SymmetricKeySpecFactory
public class SymmetricKeySpecFactoryImplPbe extends Object implements SymmetricKeySpecFactory
Implementation ofSymmetricKeySpecFactoryfor PBE (PBEKeySpec). For sufficient security strength you should use a salt of20bytes, akey lengthof256bits (never use less than128bits) and a high number of iterations (e.g.65536).- Since:
- 1.0.0
- Author:
- Joerg Hohwiller (hohwille at users.sourceforge.net)
-
-
Constructor Summary
Constructors Constructor Description SymmetricKeySpecFactoryImplPbe()The constructor.SymmetricKeySpecFactoryImplPbe(byte[] salt)The constructor.SymmetricKeySpecFactoryImplPbe(byte[] salt, int iterationCount)The constructor.SymmetricKeySpecFactoryImplPbe(byte[] salt, int iterationCount, int keyLength)The constructor.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description KeySpeccreateKeySpec(String password)intgetIterationCount()intgetKeyLength()
-
-
-
Constructor Detail
-
SymmetricKeySpecFactoryImplPbe
public SymmetricKeySpecFactoryImplPbe()
The constructor.
-
SymmetricKeySpecFactoryImplPbe
public SymmetricKeySpecFactoryImplPbe(byte[] salt)
The constructor.- Parameters:
salt- thesaltornullfor no salting.
-
SymmetricKeySpecFactoryImplPbe
public SymmetricKeySpecFactoryImplPbe(byte[] salt, int iterationCount)The constructor.- Parameters:
salt- thesaltornullfor no salting.iterationCount- theiteration count.
-
SymmetricKeySpecFactoryImplPbe
public SymmetricKeySpecFactoryImplPbe(byte[] salt, int iterationCount, int keyLength)The constructor.- Parameters:
salt- thesaltornullfor no salting.iterationCount- theiteration count.keyLength- thekey length.
-
-
Method Detail
-
createKeySpec
public KeySpec createKeySpec(String password)
- Specified by:
createKeySpecin interfaceSymmetricKeySpecFactory- Parameters:
password- the secret password.- Returns:
- the
KeySpecfor the given password. May contain additional information like salt.
-
getIterationCount
public int getIterationCount()
- Returns:
- the
iteration countor0for no iterations.
-
getKeyLength
public int getKeyLength()
- Returns:
- the
key lengthin bits or0if unspecified (to use defaults).
-
-