From c38f6c471d640a73e9c512b64c22001cdec3ba65 Mon Sep 17 00:00:00 2001 From: Harsh Shandilya Date: Wed, 1 Aug 2018 02:47:34 +0530 Subject: Extract error messages to string resources Useful for validation errors and localisation later on Signed-off-by: Harsh Shandilya --- app/src/main/java/com/wireguard/crypto/KeyEncoding.java | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) (limited to 'app/src/main/java/com/wireguard/crypto/KeyEncoding.java') diff --git a/app/src/main/java/com/wireguard/crypto/KeyEncoding.java b/app/src/main/java/com/wireguard/crypto/KeyEncoding.java index 09d27f2d..3e221caa 100644 --- a/app/src/main/java/com/wireguard/crypto/KeyEncoding.java +++ b/app/src/main/java/com/wireguard/crypto/KeyEncoding.java @@ -5,6 +5,9 @@ package com.wireguard.crypto; +import com.wireguard.android.Application; +import com.wireguard.android.R; + /** * This is a specialized constant-time base64 and hex implementation that resists side-channel attacks. */ @@ -15,11 +18,11 @@ public final class KeyEncoding { public static final int KEY_LENGTH_BASE64 = 44; public static final int KEY_LENGTH_HEX = 64; private static final String KEY_LENGTH_BASE64_EXCEPTION_MESSAGE = - "WireGuard base64 keys must be 44 characters encoding 32 bytes"; + Application.get().getString(R.string.key_length_base64_exception_message); private static final String KEY_LENGTH_EXCEPTION_MESSAGE = - "WireGuard keys must be 32 bytes"; + Application.get().getString(R.string.key_length_exception_message); private static final String KEY_LENGTH_HEX_EXCEPTION_MESSAGE = - "WireGuard hex keys must be 64 characters encoding 32 bytes"; + Application.get().getString(R.string.key_length_hex_exception_message); private KeyEncoding() { // Prevent instantiation. -- cgit v1.3-18-gd494