[Java] Encrypter AES/CBC/PKCS5Padding y Base64

private static String desencriptar( String texto ){ byte[] decValue = null; try { System.out.println("1"); byte[] decodedValue = new BASE64Decoder().decodeBuffer(texto); System.out.println("2"); byte[] iv = "M1Cl4VE".getBytes("UTF-8"); System.out.println("3"); Cipher c = Cipher.getInstance("AES/CBC/PKCS5Padding", new SunJCE()); System.out.println("4"); c.init( Cipher.DECRYPTMODE, generateKey(), new IvParameterSpec(iv)); System.out.println("5"); decValue = c.doFinal(decodedValue); } catch (InvalidKeyException ex) { System.err.println( ex.getMessage() ); } catch (IllegalBlockSizeException ex) { System.err.println( ex.getMessage() ); } catch (BadPaddingException ex) { System.err.println( ex.getMessage() ); } catch (IOException ex) { System.err.println( ex.getMessage() ); }catch (NoSuchAlgorithmException ex) { System.err.println( ex.getMessage() ); } catch (NoSuchPaddingException ex) { System.err.println( ex.getMessage() ); } catch (InvalidAlgorithmParameterException e) { e.printStackTrace(); } catch (Exception e) { e.printStackTrace(); } return new String(decValue); } public static final String encriptar(final String texto) throws Exception { byte[] iv = "M1CL4VE".getBytes("UTF-8"); Cipher c = Cipher.getInstance("AES/CBC/PKCS5Padding", new SunJCE()); c.init(Cipher.ENCRYPTMODE,generateKey(),new IvParameterSpec(iv)); byte[] stringBytes = texto.getBytes(); byte[] raw = c.doFinal(stringBytes); return new String(Base64.encodeBase64(raw), "UTF-8"); } private static Key generateKey() throws Exception { // Se especifica el nombre del algoritmo estandar para la llave secreta SecretKeyFactory factory = SecretKeyFactory.getInstance("PBKDF2WithHmacSHA1"); //Especificación del material clave que constituye una clave criptográfica . char[] password = "mipass".toCharArray(); byte[] salt = "1ngappl1".getBytes("UTF-8"); //Se especifica que la llave será a 128 bits KeySpec spec = new PBEKeySpec(password, salt, 65536, 128); SecretKey tmp = factory.generateSecret(spec); byte[] encoded = tmp.getEncoded(); return new SecretKeySpec(encoded, "AES"); }