title: Java Contains illegal character for hexBinary
body: <p>the problem I'm facing is that when I read from file(string) for example:</p>
  
  <ul>
  <li>ffffffffffffffffffffffffffffffff</li>
  </ul>
  
  <p>It shows that Error <strong>"contains illegal character for hexBinary: ffffffffffffffffffffffffffffffff"</strong> but when I give the statement as a basic <strong><em>String = ffffffffffffffffffffffffffffffff;</em></strong> everything works fine.</p>
  
  <pre><code>public static void main(String[] args) throws Exception {
  System.out.println( "128-bit hex key example: ffffffffffffffffffffffffffffffff" );
  
  try(BufferedReader br = new BufferedReader(new FileReader("E:\\TESTS\\tests.txt"))) {
      StringBuilder sb = new StringBuilder();
      String line = br.readLine();
  
      while (line != null) {
          sb.append(line);
          sb.append(System.lineSeparator());
          line = br.readLine();
      }
      String everything = sb.toString();
  
  
  Scanner scanner = new Scanner( System.in );
   System.out.println( "Enter 128-bit hex key: " );
   final String keyHex = scanner.nextLine();
  
   final String plaintextHex = "aaaaaaaaaabbbbbbbbbbccccccccccff";
  
  SecretKey key = new SecretKeySpec(DatatypeConverter
      .parseHexBinary(keyHex), "AES");
  System.out.println(everything);
  Cipher cipher = Cipher.getInstance("AES/ECB/NoPadding");
  cipher.init(Cipher.ENCRYPT_MODE, key);
  
  byte[] result = cipher.doFinal(DatatypeConverter
      .parseHexBinary(everything));
  
  System.out.println(DatatypeConverter.printHexBinary(result));
  
  Cipher cipherd = Cipher.getInstance("AES/ECB/NoPadding");
  cipherd.init(Cipher.DECRYPT_MODE, key);
  
  byte[] result2 = cipherd.doFinal(result);
  System.out.println(DatatypeConverter.printHexBinary(result2));
  
  }}
  </code></pre>