From 4f02817ef0a7f0383468805f8e9a976a85d43e3e Mon Sep 17 00:00:00 2001 From: Samuel Holland Date: Mon, 8 Jan 2018 20:42:58 -0600 Subject: global: Fix or suppress most lints/warnings Signed-off-by: Samuel Holland --- app/src/main/java/com/wireguard/crypto/KeyEncoding.java | 7 ++++++- app/src/main/java/com/wireguard/crypto/Keypair.java | 1 + 2 files changed, 7 insertions(+), 1 deletion(-) (limited to 'app/src/main/java/com/wireguard/crypto') diff --git a/app/src/main/java/com/wireguard/crypto/KeyEncoding.java b/app/src/main/java/com/wireguard/crypto/KeyEncoding.java index f83fd0b1..99ff0ee9 100644 --- a/app/src/main/java/com/wireguard/crypto/KeyEncoding.java +++ b/app/src/main/java/com/wireguard/crypto/KeyEncoding.java @@ -6,12 +6,17 @@ package com.wireguard.crypto; * This is a specialized constant-time base64 implementation that resists side-channel attacks. */ -public class KeyEncoding { +@SuppressWarnings("MagicNumber") +public final class KeyEncoding { public static final int KEY_LENGTH = 32; public static final int KEY_LENGTH_BASE64 = 44; private static final String KEY_LENGTH_BASE64_EXCEPTION_MESSAGE = "WireGuard base64 keys must be 44 characters encoding 32 bytes"; + private KeyEncoding() { + // Prevent instantiation. + } + private static int decodeBase64(final char[] src, final int src_offset) { int val = 0; for (int i = 0; i < 4; ++i) { diff --git a/app/src/main/java/com/wireguard/crypto/Keypair.java b/app/src/main/java/com/wireguard/crypto/Keypair.java index 25327182..0fc08508 100644 --- a/app/src/main/java/com/wireguard/crypto/Keypair.java +++ b/app/src/main/java/com/wireguard/crypto/Keypair.java @@ -6,6 +6,7 @@ import java.security.SecureRandom; * Represents a Curve25519 keypair as used by WireGuard. */ +@SuppressWarnings("MagicNumber") public class Keypair { private final byte[] privateKey; private final byte[] publicKey; -- cgit v1.2.3