From 7a680ba9aa613445b1b61f8ffe86f203a62047ba Mon Sep 17 00:00:00 2001 From: BeRealQueally <129683130+BeRealQueally@users.noreply.github.com> Date: Wed, 14 Feb 2024 03:19:26 +0800 Subject: [PATCH] fix: bad base64 contain "\n" cannot be decoded --- util/src/main/java/com/infineon/esim/util/Bytes.java | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/util/src/main/java/com/infineon/esim/util/Bytes.java b/util/src/main/java/com/infineon/esim/util/Bytes.java index 498e821..a3483f3 100644 --- a/util/src/main/java/com/infineon/esim/util/Bytes.java +++ b/util/src/main/java/com/infineon/esim/util/Bytes.java @@ -383,7 +383,8 @@ public static String encodeBase64String(byte[] input) { * @return Byte array with decoded data */ public static byte[] decodeBase64String(String input) { - return Base64.getDecoder().decode(input); + String str = input.replace("\n",""); + return Base64.getDecoder().decode(str); } public static String encodeString(byte[] input) {