unity.util
Class XMLEncryptDecrypt

java.lang.Object
  extended by unity.util.XMLEncryptDecrypt

public class XMLEncryptDecrypt
extends java.lang.Object

Version:
1.0 XMLEncryptDecrypt is designed to provide functionality to encrypt and decrypt data sources using Password Based Encryption with MD5 and DES. The user supplied password is converted into an encryption key for DES using the MD5 hash algorithm. The data is then encrypted or decrypted accordingly.
Author:
Devansh Dhutia

Constructor Summary
XMLEncryptDecrypt(java.lang.String pass)
          Default constructor.
 
Method Summary
 void encrypt(java.io.InputStream in, java.io.OutputStream out)
          Encrypts data from a source to another using the key generated with password in the constructor.
 java.io.InputStream getDecryptStream(java.io.InputStream in)
          Provides a wrapper stream around the original encrypted input to decrypt.
 java.io.InputStream getDecryptStream(java.lang.String string)
          Provides a wrapper stream around the original encrypted input to decrypt.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

XMLEncryptDecrypt

public XMLEncryptDecrypt(java.lang.String pass)
Default constructor. Must use this regardless of what functionality (encryption/decryption) is required.

Parameters:
pass - A string of one or more words that will serve as a password.
Method Detail

encrypt

public void encrypt(java.io.InputStream in,
                    java.io.OutputStream out)
             throws java.io.IOException
Encrypts data from a source to another using the key generated with password in the constructor.

Parameters:
in - Clear text InputStream
out - OutputStream to which to write encrypted data.
Throws:
java.io.IOException

getDecryptStream

public java.io.InputStream getDecryptStream(java.lang.String string)
                                     throws java.io.IOException,
                                            java.io.FileNotFoundException
Provides a wrapper stream around the original encrypted input to decrypt.

Parameters:
string - path to encrypted source to decrypt
Returns:
Returns an InputStream where the data will decrypted on every read() call.
Throws:
java.io.IOException
java.io.FileNotFoundException

getDecryptStream

public java.io.InputStream getDecryptStream(java.io.InputStream in)
                                     throws java.io.IOException,
                                            java.io.FileNotFoundException
Provides a wrapper stream around the original encrypted input to decrypt.

Parameters:
string - path to encrypted source to decrypt
Returns:
Returns an InputStream where the data will decrypted on every read() call.
Throws:
java.io.IOException
java.io.FileNotFoundException