I would like to encrypt and decrypt a password using 128 bit AES encryption with 16 byte key. I am getting javax.crypto.BadPaddingException error while decrypt
javax.crypto.BadPaddingException
Try this, a simpler solution.
byte[] salt = "ThisIsASecretKey".getBytes(); Key key = new SecretKeySpec(salt, 0, 16, "AES"); Cipher cipher = Cipher.getInstance("AES");