|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.apache.fulcrum.jce.crypto.CryptoUtil
public final class CryptoUtil
Helper class to provde generic functions to work with CryptoStreams. The code uses parts from Markus Hahn's Blowfish library found at http://blowfishj.sourceforge.net/
Constructor Summary | |
---|---|
CryptoUtil()
|
Method Summary | |
---|---|
static long |
copy(InputStream is,
OutputStream os)
Deprecated. use StreamUtil instead |
static 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. |
static void |
decrypt(Object source,
Object target,
char[] password)
Copies from a source to a target object using decryption. |
static String |
decryptString(CryptoStreamFactory factory,
String cipherText,
char[] password)
Decrypts an encrypted string into the plain text. |
static String |
decryptString(String cipherText,
char[] password)
Decrypts an encrypted string into the plain text. |
static 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 void |
encrypt(Object source,
Object target,
char[] password)
Copies from a source to a target object using encryption |
static String |
encryptString(CryptoStreamFactory factory,
String plainText,
char[] password)
Encrypts a string into a hex string. |
static String |
encryptString(String plainText,
char[] password)
Encrypts a string into a hex string. |
static CryptoStreamFactory |
getCryptoStreamFactory()
|
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public CryptoUtil()
Method Detail |
---|
public static void encrypt(Object source, Object target, char[] password) throws GeneralSecurityException, IOException
source
- the source objecttarget
- the target objectpassword
- the password to use for encryption
GeneralSecurityException
- accessing JCE failed
IOException
- accessing the souce failedpublic static void encrypt(CryptoStreamFactory factory, Object source, Object target, char[] password) throws GeneralSecurityException, IOException
factory
- the factory to create the crypto streamssource
- the source objecttarget
- the target objectpassword
- the password to use for encryption
GeneralSecurityException
- accessing JCE failed
IOException
- accessing the souce failedpublic static void decrypt(Object source, Object target, char[] password) throws GeneralSecurityException, IOException
source
- the source objecttarget
- the target objectpassword
- the password to use for decryption
GeneralSecurityException
- accessing JCE failed
IOException
- accessing the souce failedpublic static void decrypt(CryptoStreamFactory factory, Object source, Object target, char[] password) throws GeneralSecurityException, IOException
factory
- the factory to create the crypto streamssource
- the source objecttarget
- the target objectpassword
- the password to use for decryption
GeneralSecurityException
- accessing JCE failed
IOException
- accessing the souce failedpublic static String encryptString(String plainText, char[] password) throws GeneralSecurityException, IOException
plainText
- the plain text to be encryptedpassword
- the password for encryption
GeneralSecurityException
- accessing JCE failed
IOException
- accessing the souce failedpublic static String encryptString(CryptoStreamFactory factory, String plainText, char[] password) throws GeneralSecurityException, IOException
factory
- the factory to create the crypto streamsplainText
- the plain text to be encryptedpassword
- the password for encryption
GeneralSecurityException
- accessing JCE failed
IOException
- accessing the souce failedpublic static String decryptString(String cipherText, char[] password) throws GeneralSecurityException, IOException
cipherText
- the encrypted text to be decryptedpassword
- the password for decryption
GeneralSecurityException
- accessing JCE failed
IOException
- accessing the souce failedpublic static String decryptString(CryptoStreamFactory factory, String cipherText, char[] password) throws GeneralSecurityException, IOException
factory
- the factory to create the crypto streamscipherText
- the encrypted text to be decryptedpassword
- the password for decryption
GeneralSecurityException
- accessing JCE failed
IOException
- accessing the souce failedpublic static long copy(InputStream is, OutputStream os) throws IOException
is
- the source input streamos
- the target output stream
IOException
- the copying failedpublic static CryptoStreamFactory getCryptoStreamFactory()
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |