src/jpm/dg/Crypto.java
/**
	 * Password encrypts text using AES.
	 * 
	 * @param pass
	 *            The user-provided password.
	 * @param clearText
	 *            The text to encrypt.
	 * @return A hexadecimal representation of the encrypted text.
	 * @throws Exception
	 */
Password encrypts text using AES.

@param pass
The user-provided password.
@param clearText
The text to encrypt.
@return A hexadecimal representation of the encrypted text.
@throws Exception
Password encrypts text using AES . @param pass The user - provided password . @param clearText The text to encrypt . @return A hexadecimal representation of the encrypted text . @throws Exception
public static String encrypt(String pass, String clearText)
			throws Exception {
		byte[] rawKey = getRawKey(pass.getBytes("ISO-8859-1"));
		Cipher cipher = Cipher.getInstance("AES");
		cipher.init(Cipher.ENCRYPT_MODE, new SecretKeySpec(rawKey, "AES"));
		byte[] result = cipher.doFinal(clearText.getBytes("ISO-8859-1"));
		StringBuffer buffer = new StringBuffer(2 * result.length);
		for (int i = 0; i < result.length; i++) {
			buffer.append(HEX.charAt((result[i] >> 4) & 0x0f)).append(
					HEX.charAt(result[i] & 0x0f));
		}
		return buffer.toString();
	}
public static String encrypt ( String pass , String clearText ) throws Exception { byte [ ] rawKey = getRawKey ( pass . getBytes ( "ISO-8859-1" ) ) ; Cipher cipher = Cipher . getInstance ( "AES" ) ; cipher . init ( Cipher . ENCRYPT_MODE , new SecretKeySpec ( rawKey , "AES" ) ) ; byte [ ] result = cipher . doFinal ( clearText . getBytes ( "ISO-8859-1" ) ) ; StringBuffer buffer = new StringBuffer ( 2 * result . length ) ; for ( int i = 0 ; i < result . length ; i ++ ) { buffer . append ( HEX . charAt ( ( result [ i ] >> 4 ) & 0x0f ) ) . append ( HEX . charAt ( result [ i ] & 0x0f ) ) ; } return buffer . toString ( ) ; }
Password encrypts text using AES.
Password encrypts text using AES .