aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/app/src/main/java/com/wireguard/crypto
diff options
context:
space:
mode:
authorHarsh Shandilya <harsh@prjkt.io>2018-08-01 02:47:34 +0530
committerJason A. Donenfeld <Jason@zx2c4.com>2018-08-26 11:04:01 -0600
commit03415e63b4fbd34ee73fd83726c57782b81a2756 (patch)
tree404fc99e6684998f39a6466b4581decbba3c4f4b /app/src/main/java/com/wireguard/crypto
parentMonkeyedSnackbar: remove (diff)
downloadwireguard-android-03415e63b4fbd34ee73fd83726c57782b81a2756.tar.xz
wireguard-android-03415e63b4fbd34ee73fd83726c57782b81a2756.zip
Extract error messages to string resources
Useful for validation errors and localisation later on Signed-off-by: Harsh Shandilya <harsh@prjkt.io>
Diffstat (limited to 'app/src/main/java/com/wireguard/crypto')
-rw-r--r--app/src/main/java/com/wireguard/crypto/KeyEncoding.java9
1 files changed, 6 insertions, 3 deletions
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.