Keypair: Minimize the scope of warning suppression

Signed-off-by: Samuel Holland <samuel@sholland.org>
This commit is contained in:
Samuel Holland 2018-05-02 10:30:54 -05:00
parent 3e8d457501
commit e8d8d5dc29

View File

@ -11,7 +11,6 @@ import java.security.SecureRandom;
* Represents a Curve25519 keypair as used by WireGuard. * Represents a Curve25519 keypair as used by WireGuard.
*/ */
@SuppressWarnings("MagicNumber")
public class Keypair { public class Keypair {
private final byte[] privateKey; private final byte[] privateKey;
private final byte[] publicKey; private final byte[] publicKey;
@ -29,6 +28,7 @@ public class Keypair {
this(KeyEncoding.keyFromBase64(privateKey)); this(KeyEncoding.keyFromBase64(privateKey));
} }
@SuppressWarnings("MagicNumber")
private static byte[] generatePrivateKey() { private static byte[] generatePrivateKey() {
final SecureRandom secureRandom = new SecureRandom(); final SecureRandom secureRandom = new SecureRandom();
final byte[] privateKey = new byte[KeyEncoding.KEY_LENGTH]; final byte[] privateKey = new byte[KeyEncoding.KEY_LENGTH];