Constant time base64

Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
This commit is contained in:
Jason A. Donenfeld authored and Samuel Holland committed 2017-08-08 18:22:41 +02:00
1 parent f8d8e5e23e
commit f6b864d4e7
3 files changed
+82 -20

No files matched your search

@@ -6,6 +6,7 @@ import android.databinding.Observable;
import com.wireguard.android.BR;
import com.wireguard.crypto.Keypair;
import com.wireguard.crypto.KeyEncoding;
/**
* Represents the configuration for a WireGuard interface (an [Interface] block).
@@ -90,7 +91,7 @@ public class Interface extends BaseObservable implements Observable {
public void setPrivateKey(String privateKey) {
// Avoid exceptions from Keypair while the user is typing.
if (privateKey.length() != Keypair.KEY_STRING_LENGTH)
if (privateKey.length() != KeyEncoding.WG_KEY_LEN_BASE64)
return;
keypair = new Keypair(privateKey);
notifyPropertyChanged(BR.privateKey);