Symmetric Encryption isn't working <p>I am trying to generate cipher text and decrypted data. I already have assigned my incrypted value and key. But when I run the program in netbeans it shows error in the execution area, but no cipher text and decrypted data is produced.</p> <p>Encryption.java:</p> <pre><code>package encryption; import javax.crypto.Cipher; import javax.crypto.spec.SecretKeySpec; public class Encryption { private static byte[] message; public static void main(String[] args) throws Exception { byte[] message = {0, 0, 1, 2, 3, 4, 5, 6, 7, 6, 5, 4, 2, 3, 8, 9}; byte[] key = {1, 1, 1, 1, 2, 2, 2, 2, 3, 3, 3, 3, 4, 4, 4, 4}; byte[] ciphertext; byte[] decrypted; Sender s = new Sender(); s.send(message); Receiver r = new Receiver(); r.receive(message); // TODO code application logic here } } </code></pre> <p>Sender.java:</p> <pre><code>package encryption; import javax.crypto.Cipher; import javax.crypto.spec.SecretKeySpec; public class Sender { private Cipher encoder; private SecretKeySpec myKey; public Sender() throws Exception { encoder = Cipher.getInstance("AES"); } public void setKey(byte[] key) throws Exception { myKey = new SecretKeySpec(key, "AES"); encoder.init(Cipher.ENCRYPT_MODE, myKey); } public byte[] send(byte[] message) throws Exception { return encoder.doFinal(message); } } </code></pre> <p>Receiver.java:</p> <pre><code>package encryption; import javax.crypto.Cipher; import javax.crypto.spec.SecretKeySpec; public class Receiver { private Cipher decoder; private SecretKeySpec myKey; public Receiver()throws Exception{ decoder=Cipher.getInstance("AES"); } public void setKey(byte[] key) throws Exception{ myKey= new SecretKeySpec(key ,"AES"); decoder.init(Cipher.DECRYPT_MODE, myKey); } public byte[] receive(byte[] message) throws Exception{ return decoder.doFinal(message); } } </code></pre>