summaryrefslogtreecommitdiffhomepage
path: root/app/src/main/java/com/wireguard/crypto
diff options
context:
space:
mode:
authorHarsh Shandilya <me@msfjarvis.dev>2018-08-01 02:47:34 +0530
committerJason A. Donenfeld <Jason@zx2c4.com>2018-08-26 11:04:01 -0600
commitc38f6c471d640a73e9c512b64c22001cdec3ba65 (patch)
tree404fc99e6684998f39a6466b4581decbba3c4f4b /app/src/main/java/com/wireguard/crypto
parent85462de254050cc693f6f51cc549899fd656913a (diff)
Extract error messages to string resources
Useful for validation errors and localisation later on Signed-off-by: Harsh Shandilya <me@msfjarvis.dev>
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.