Class CryptoUtilJ8
- java.lang.Object
-
- org.apache.fulcrum.jce.crypto.CryptoUtil
-
- org.apache.fulcrum.jce.crypto.extended.CryptoUtilJ8
-
public final class CryptoUtilJ8 extends CryptoUtil
Helper class to provide typed functions to work with CryptoStreams.- Author:
- Siegfried Goeschl , Georg Kallidis
-
-
Field Summary
-
Fields inherited from class org.apache.fulcrum.jce.crypto.CryptoUtil
cryptoStreamFactory
-
-
Constructor Summary
Constructors Modifier Constructor Description protected
CryptoUtilJ8(CryptoParametersJ8.TYPES type, byte[] salt, int count)
-
Method Summary
Modifier and Type Method Description protected void
decrypt(CryptoStreamFactory factory, Object source, Object target, char[] password)
Copies from a source to a target object using decryption and a caller-suppier CryptoStreamFactory.void
encrypt(CryptoStreamFactory factory, Object source, Object target, char[] password)
Copies from a source to a target object using encryption and a caller supplied CryptoStreamFactory.static CryptoUtilJ8
getInstance()
Factory method to get a default instance default type PDCstatic CryptoUtilJ8
getInstance(CryptoParametersJ8.TYPES type)
Factory method to get a default instancestatic CryptoUtilJ8
getInstance(CryptoParametersJ8.TYPES type, byte[] salt, int count)
Factory method to get a default instancestatic Map<CryptoParametersJ8.TYPES,CryptoUtilJ8>
getInstances()
static Map<CryptoParametersJ8.TYPES,CryptoUtilJ8>
getInstancesWithExplicitParams()
-
Methods inherited from class org.apache.fulcrum.jce.crypto.CryptoUtil
copy, decrypt, decryptString, decryptString, decryptString, decryptStringWithClearCode, encrypt, encryptString, encryptString, encryptStringWithClearCode, getCryptoStreamFactory, getInstance
-
-
-
-
Constructor Detail
-
CryptoUtilJ8
protected CryptoUtilJ8(CryptoParametersJ8.TYPES type, byte[] salt, int count)
- Parameters:
type
- one of the enumCryptoParametersJ8.TYPES
.salt
- vcount
- the iteration count
-
-
Method Detail
-
getInstance
public static CryptoUtilJ8 getInstance()
Factory method to get a default instance default type PDC- Returns:
- an instance of the CryptoStreamFactory
-
getInstance
public static CryptoUtilJ8 getInstance(CryptoParametersJ8.TYPES type)
Factory method to get a default instance- Parameters:
type
- one of the enumCryptoParametersJ8.TYPES
.- Returns:
- an instance of the CryptoStreamFactory
-
getInstance
public static CryptoUtilJ8 getInstance(CryptoParametersJ8.TYPES type, byte[] salt, int count)
Factory method to get a default instance- Parameters:
type
- one of the enumCryptoParametersJ8.TYPES
.salt
- the saltcount
- the iteration count- Returns:
- an instance of the CryptoStreamFactory
-
encrypt
public void encrypt(CryptoStreamFactory factory, Object source, Object target, char[] password) throws GeneralSecurityException, IOException
Copies from a source to a target object using encryption and a caller supplied CryptoStreamFactory.CryptoStreamFactoryJ8Template.getOutputStream(InputStream, OutputStream, char[])
- Overrides:
encrypt
in classCryptoUtil
- Parameters:
factory
- the factory to create the crypto streamssource
- the source objecttarget
- the target objectpassword
- the password to use for encryption- Throws:
GeneralSecurityException
- accessing JCE failedIOException
- accessing the source failed
-
decrypt
protected void decrypt(CryptoStreamFactory factory, Object source, Object target, char[] password) throws GeneralSecurityException, IOException
Copies from a source to a target object using decryption and a caller-suppier CryptoStreamFactory.- Overrides:
decrypt
in classCryptoUtil
- Parameters:
factory
- the factory to create the crypto streamssource
- the source objecttarget
- the target objectpassword
- the password to use for decryption- Throws:
GeneralSecurityException
- accessing JCE failedIOException
- accessing the source failed
-
getInstances
public static Map<CryptoParametersJ8.TYPES,CryptoUtilJ8> getInstances()
-
getInstancesWithExplicitParams
public static Map<CryptoParametersJ8.TYPES,CryptoUtilJ8> getInstancesWithExplicitParams()
-
-