hi all, i am trying the File encryption using AES on android but there is a weird exception occured everytime,i am not able to find out the solution for this exception. my code for encryption is:
public void encrypt(File file,String aesKey) throws Exception { try { byte[] byteKey = aesKey.getBytes("UTF8"); KeySpec ks = new SecretKeySpec(byteKey,"AES"); SecretKeyFactory skf = SecretKeyFactory.getInstance("AES"); SecretKey sk = skf.generateSecret(ks); aspec = new IvParameterSpec(ivector); encCipher = Cipher.getInstance("AES/CBC/PKCS7Padding"); encCipher.init(Cipher.ENCRYPT_MODE, sk); in = new FileInputStream(file); AlertDialog.Builder builder = new AlertDialog.Builder(null); builder.setMessage("you are in middle of encrypt function"); AlertDialog alert = builder.create(); FileOutputStream fout = new FileOutputStream("/mnt/sdcard/b.txt"); out = new CipherOutputStream(fout,encCipher); int num = 0; while((num = in.read(buffer)) >=0) { out.write(buffer, 0, num); } out.close(); } -- You received this message because you are subscribed to the Google Groups "Android Developers" group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en