diff options
author | Samuel Holland <samuel@sholland.org> | 2017-08-09 02:51:08 -0500 |
---|---|---|
committer | Samuel Holland <samuel@sholland.org> | 2017-08-09 02:51:08 -0500 |
commit | f0f9192aedaa4bef9ceb42dfb7b11cc1c9baf39a (patch) | |
tree | 7166f391b9a2fac15cd913082a96ab542f332fe6 /app/src/main/java/com/wireguard/crypto/Keypair.java | |
parent | c3afe5be2c0677aa28cd2c9a49b001a5570f321a (diff) |
KeyEncoding: Clean up and reorganize to match style
Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
Diffstat (limited to 'app/src/main/java/com/wireguard/crypto/Keypair.java')
-rw-r--r-- | app/src/main/java/com/wireguard/crypto/Keypair.java | 6 |
1 files changed, 2 insertions, 4 deletions
diff --git a/app/src/main/java/com/wireguard/crypto/Keypair.java b/app/src/main/java/com/wireguard/crypto/Keypair.java index 71c7066c..bd6fd90f 100644 --- a/app/src/main/java/com/wireguard/crypto/Keypair.java +++ b/app/src/main/java/com/wireguard/crypto/Keypair.java @@ -1,7 +1,5 @@ package com.wireguard.crypto; -import android.util.Base64; - import java.security.SecureRandom; /** @@ -11,7 +9,7 @@ import java.security.SecureRandom; public class Keypair { private static byte[] generatePrivateKey() { final SecureRandom secureRandom = new SecureRandom(); - final byte[] privateKey = new byte[KeyEncoding.WG_KEY_LEN]; + final byte[] privateKey = new byte[KeyEncoding.KEY_LENGTH]; secureRandom.nextBytes(privateKey); privateKey[0] &= 248; privateKey[31] &= 127; @@ -20,7 +18,7 @@ public class Keypair { } private static byte[] generatePublicKey(byte[] privateKey) { - final byte[] publicKey = new byte[KeyEncoding.WG_KEY_LEN]; + final byte[] publicKey = new byte[KeyEncoding.KEY_LENGTH]; Curve25519.eval(publicKey, 0, privateKey, null); return publicKey; } |