diff options
author | Jason A. Donenfeld <Jason@zx2c4.com> | 2019-02-08 00:44:14 +0100 |
---|---|---|
committer | Jason A. Donenfeld <Jason@zx2c4.com> | 2019-02-08 03:23:15 +0100 |
commit | 05547861b65100279027a64f58793caea1143a30 (patch) | |
tree | c69303b55e68e93efc71d2b199119019f1199ff6 /WireGuard/WireGuard/UI/macOS | |
parent | TunnelsManager: Ignore status changes on tunnel providers we don't have (diff) | |
download | wireguard-apple-05547861b65100279027a64f58793caea1143a30.tar.xz wireguard-apple-05547861b65100279027a64f58793caea1143a30.zip |
Key: Constant time encoding
Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
Diffstat (limited to 'WireGuard/WireGuard/UI/macOS')
-rw-r--r-- | WireGuard/WireGuard/UI/macOS/ViewController/TunnelEditViewController.swift | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/WireGuard/WireGuard/UI/macOS/ViewController/TunnelEditViewController.swift b/WireGuard/WireGuard/UI/macOS/ViewController/TunnelEditViewController.swift index 27d60c7..395eeb4 100644 --- a/WireGuard/WireGuard/UI/macOS/ViewController/TunnelEditViewController.swift +++ b/WireGuard/WireGuard/UI/macOS/ViewController/TunnelEditViewController.swift @@ -104,8 +104,8 @@ class TunnelEditViewController: NSViewController { let tunnelConfiguration = tunnel.tunnelConfiguration! nameRow.value = tunnel.name textView.string = tunnelConfiguration.asWgQuickConfig() - publicKeyRow.value = tunnelConfiguration.interface.publicKey.base64EncodedString() - textView.privateKeyString = tunnelConfiguration.interface.privateKey.base64EncodedString() + publicKeyRow.value = tunnelConfiguration.interface.publicKey.base64Key() ?? "" + textView.privateKeyString = tunnelConfiguration.interface.privateKey.base64Key() ?? "" if tunnel.activateOnDemandSetting.isActivateOnDemandEnabled { selectedActivateOnDemandOption = tunnel.activateOnDemandSetting.activateOnDemandOption } else { @@ -115,17 +115,17 @@ class TunnelEditViewController: NSViewController { // Creating a new tunnel let privateKey = Curve25519.generatePrivateKey() let publicKey = Curve25519.generatePublicKey(fromPrivateKey: privateKey) - let bootstrappingText = "[Interface]\nPrivateKey = \(privateKey.base64EncodedString())\n" - publicKeyRow.value = publicKey.base64EncodedString() + let bootstrappingText = "[Interface]\nPrivateKey = \(privateKey.base64Key() ?? "")\n" + publicKeyRow.value = publicKey.base64Key() ?? "" textView.string = bootstrappingText selectedActivateOnDemandOption = .none } privateKeyObservationToken = textView.observe(\.privateKeyString) { [weak publicKeyRow] textView, _ in if let privateKeyString = textView.privateKeyString, - let privateKey = Data(base64Encoded: privateKeyString), + let privateKey = Data(base64Key: privateKeyString), privateKey.count == TunnelConfiguration.keyLength { let publicKey = Curve25519.generatePublicKey(fromPrivateKey: privateKey) - publicKeyRow?.value = publicKey.base64EncodedString() + publicKeyRow?.value = publicKey.base64Key() ?? "" } else { publicKeyRow?.value = "" } |