Encryption message in java
<p>i am a project about using java's bouncycastle to do the encryption.</p>

<p>However, when I encrypt the message, it throws an exception for me.</p>

<p>javax.crypto.IllegalBlockSizeException: data not block size aligned</p>

<p>I am using Blowfish/ECB/NoPadding, and the message is an xml.</p>

<pre><code>public static void main(String args[]){ 
     String message = "&lt;abc&gt;ABCDEFG&lt;/abc&gt;"; 
     String key = "key"; 
     byte[] b = encrypt(message.getBytes(), key.getBytes());
}

public byte[] encrypt(byte encrypt[], byte en_key[]) { 
     try { 
           SecretKeySpec key = new SecretKeySpec(en_key, "Blowfish"); 
           Cipher cipher = Cipher.getInstance("Blowfish/ECB/NoPadding"); 
           cipher.init(Cipher.ENCRYPT_MODE, en_key); 
           return cipher.doFinal(encrypt); 
     } catch (Exception e) { 
           e.printStackTrace();
           return null; 
         }

} 
</code></pre>

<p>Could anyone can help me?</p>

<p>Thank you</p>
