equal
deleted
inserted
replaced
24 */ |
24 */ |
25 |
25 |
26 package sun.security.util; |
26 package sun.security.util; |
27 |
27 |
28 import java.io.IOException; |
28 import java.io.IOException; |
|
29 import java.nio.charset.StandardCharsets; |
29 import java.util.Base64; |
30 import java.util.Base64; |
30 |
31 |
31 /** |
32 /** |
32 * The Length interface defines the length of an object |
33 * The Length interface defines the length of an object |
33 */ |
34 */ |
40 * characters in the base-64 alphabet and whitespaces. |
41 * characters in the base-64 alphabet and whitespaces. |
41 * @return the decoded bytes |
42 * @return the decoded bytes |
42 * @throws java.io.IOException if input is invalid |
43 * @throws java.io.IOException if input is invalid |
43 */ |
44 */ |
44 public static byte[] decode(String input) throws IOException { |
45 public static byte[] decode(String input) throws IOException { |
45 byte[] src = input.replaceAll("\\s+", "").getBytes(); |
46 byte[] src = input.replaceAll("\\s+", "") |
|
47 .getBytes(StandardCharsets.ISO_8859_1); |
46 try { |
48 try { |
47 return Base64.getDecoder().decode(src); |
49 return Base64.getDecoder().decode(src); |
48 } catch (IllegalArgumentException e) { |
50 } catch (IllegalArgumentException e) { |
49 throw new IOException(e); |
51 throw new IOException(e); |
50 } |
52 } |