diff --git a/app/src/main/java/io/lbry/browser/MainActivity.java b/app/src/main/java/io/lbry/browser/MainActivity.java index c113c707..4947efc5 100644 --- a/app/src/main/java/io/lbry/browser/MainActivity.java +++ b/app/src/main/java/io/lbry/browser/MainActivity.java @@ -121,6 +121,7 @@ import java.io.InputStreamReader; import java.io.PrintStream; import java.net.ConnectException; import java.net.URI; +import java.nio.charset.StandardCharsets; import java.text.DecimalFormat; import java.util.ArrayList; import java.util.Arrays; @@ -1799,7 +1800,7 @@ public class MainActivity extends AppCompatActivity implements SdkStatusListener if (!Helper.isNullOrEmpty(encryptedAuthToken)) { try { Lbryio.AUTH_TOKEN = new String(Utils.decrypt( - Base64.decode(encryptedAuthToken, Base64.NO_WRAP), this, Lbry.KEYSTORE), "UTF8"); + Base64.decode(encryptedAuthToken, Base64.NO_WRAP), this, Lbry.KEYSTORE), StandardCharsets.UTF_8); } catch (Exception ex) { // pass. A new auth token would have to be generated if the old one cannot be decrypted Log.e(TAG, "Could not decrypt existing auth token.", ex); diff --git a/app/src/main/java/io/lbry/browser/utils/Lbryio.java b/app/src/main/java/io/lbry/browser/utils/Lbryio.java index 68986978..036eb3f4 100644 --- a/app/src/main/java/io/lbry/browser/utils/Lbryio.java +++ b/app/src/main/java/io/lbry/browser/utils/Lbryio.java @@ -22,6 +22,7 @@ import java.io.IOException; import java.io.UnsupportedEncodingException; import java.lang.reflect.Type; import java.net.URLEncoder; +import java.nio.charset.StandardCharsets; import java.util.ArrayList; import java.util.HashMap; import java.util.List; @@ -304,7 +305,7 @@ public final class Lbryio { private static void broadcastAuthTokenGenerated(Context context) { try { if (context != null) { - String encryptedAuthToken = Utils.encrypt(AUTH_TOKEN.getBytes("UTF8"), context, Lbry.KEYSTORE); + String encryptedAuthToken = Utils.encrypt(AUTH_TOKEN.getBytes(StandardCharsets.UTF_8), context, Lbry.KEYSTORE); Intent intent = new Intent(MainActivity.ACTION_AUTH_TOKEN_GENERATED); intent.putExtra("authToken", encryptedAuthToken); context.sendBroadcast(intent);