|
||||||||||
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 void |
copy(java.io.InputStream is,
java.io.OutputStream os)
Pumps the input stream to the output stream. |
static void |
decrypt(CryptoStreamFactory factory,
java.lang.Object source,
java.lang.Object target,
char[] password)
Copies from a source to a target object using decryption and a caller-suppier CryptoStreamFactory. |
static void |
decrypt(java.lang.Object source,
java.lang.Object target,
char[] password)
Copies from a source to a target object using decryption. |
static java.lang.String |
decryptString(CryptoStreamFactory factory,
java.lang.String cipherText,
char[] password)
Decrypts an encrypted string into the plain text. |
static java.lang.String |
decryptString(java.lang.String cipherText,
char[] password)
Decrypts an encrypted string into the plain text. |
static void |
encrypt(CryptoStreamFactory factory,
java.lang.Object source,
java.lang.Object target,
char[] password)
Copies from a source to a target object using encryption and a caller supplied CryptoStreamFactory. |
static void |
encrypt(java.lang.Object source,
java.lang.Object target,
char[] password)
Copies from a source to a target object using encryption |
static java.lang.String |
encryptString(CryptoStreamFactory factory,
java.lang.String plainText,
char[] password)
Encrypts a string into a hex string. |
static java.lang.String |
encryptString(java.lang.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(java.lang.Object source, java.lang.Object target, char[] password) throws java.security.GeneralSecurityException, java.io.IOException
source
- the source objecttarget
- the target objectpassword
- the password to use for encryption
java.security.GeneralSecurityException
- accessing JCE failed
java.io.IOException
- accessing the souce failedpublic static void encrypt(CryptoStreamFactory factory, java.lang.Object source, java.lang.Object target, char[] password) throws java.security.GeneralSecurityException, java.io.IOException
factory
- the factory to create the crypto streamssource
- the source objecttarget
- the target objectpassword
- the password to use for encryption
java.security.GeneralSecurityException
- accessing JCE failed
java.io.IOException
- accessing the souce failedpublic static void decrypt(java.lang.Object source, java.lang.Object target, char[] password) throws java.security.GeneralSecurityException, java.io.IOException
source
- the source objecttarget
- the target objectpassword
- the password to use for decryption
java.security.GeneralSecurityException
- accessing JCE failed
java.io.IOException
- accessing the souce failedpublic static void decrypt(CryptoStreamFactory factory, java.lang.Object source, java.lang.Object target, char[] password) throws java.security.GeneralSecurityException, java.io.IOException
factory
- the factory to create the crypto streamssource
- the source objecttarget
- the target objectpassword
- the password to use for decryption
java.security.GeneralSecurityException
- accessing JCE failed
java.io.IOException
- accessing the souce failedpublic static java.lang.String encryptString(java.lang.String plainText, char[] password) throws java.security.GeneralSecurityException, java.io.IOException
plainText
- the plain text to be encryptedpassword
- the password for encryption
java.security.GeneralSecurityException
- accessing JCE failed
java.io.IOException
- accessing the souce failedpublic static java.lang.String encryptString(CryptoStreamFactory factory, java.lang.String plainText, char[] password) throws java.security.GeneralSecurityException, java.io.IOException
factory
- the factory to create the crypto streamsplainText
- the plain text to be encryptedpassword
- the password for encryption
java.security.GeneralSecurityException
- accessing JCE failed
java.io.IOException
- accessing the souce failedpublic static java.lang.String decryptString(java.lang.String cipherText, char[] password) throws java.security.GeneralSecurityException, java.io.IOException
cipherText
- the encrypted text to be decryptedpassword
- the password for decryption
java.security.GeneralSecurityException
- accessing JCE failed
java.io.IOException
- accessing the souce failedpublic static java.lang.String decryptString(CryptoStreamFactory factory, java.lang.String cipherText, char[] password) throws java.security.GeneralSecurityException, java.io.IOException
factory
- the factory to create the crypto streamscipherText
- the encrypted text to be decryptedpassword
- the password for decryption
java.security.GeneralSecurityException
- accessing JCE failed
java.io.IOException
- accessing the souce failedpublic static void copy(java.io.InputStream is, java.io.OutputStream os) throws java.io.IOException
is
- the source input streamos
- the target output stream
java.io.IOException
- the copying failedpublic static CryptoStreamFactory getCryptoStreamFactory()
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |