Hello,
Im using java to (try) to decode from a base64 url querystring.
I have been sent a (supposed to be) base64 code that I have to decode.
But I cant seem to decode the base64 code back to a string.
This is a test program:
Results:
===== decode IV =====
===== decode Key =====
===== Decoded String =====
decodedIV String : Æ$þÒéñe_Y³;7UÓ d
decodedKey String : ²LÆPT W 08=siL!9L < NÂr Q î
þÝ
Im using java to (try) to decode from a base64 url querystring.
I have been sent a (supposed to be) base64 code that I have to decode.
But I cant seem to decode the base64 code back to a string.
This is a test program:
Code:
public class AES { static String IV = "xxxYYYzzz01234xxt"; (not the actual code Im using.) static String Key = "aaaBBBcccDDDD; (not the actual code Im using.) public static void main(String [] args) { byte[] encodedIV = IV.getBytes(); byte[] encodedKey = Key.getBytes(); System.out.println("===== Encoded String ====="); System.out.println("Original String IV: " + IV ); System.out.println("Original String Key: " + Key); System.out.println(" "); //decoding byte array into base64 System.out.println("===== decode IV ====="); byte[] decodedIV = Base64.decodeBase64(encodedIV); System.out.println("===== decode Key ====="); byte[] decodedKey = Base64.decodeBase64(encodedKey);; String stringIV = new String(decodedIV); String stringKey = new String(decodedKey); System.out.println("===== Decoded String ====="); System.out.println("decodedIV String : " + new String(stringIV)); System.out.println("decodedKey String : " + new String(stringKey)); } }
===== decode IV =====
===== decode Key =====
===== Decoded String =====
decodedIV String : Æ$þÒéñe_Y³;7UÓ d
decodedKey String : ²LÆPT W 08=siL!9L < NÂr Q î
þÝ
Comment