Generating WireGuard Keys on Windows 11 Without Admin Privileges
Why This Method?
- No Disk Writes: Sensitive keys are not written to disk, reducing the attack surface.
- Clipboard Isolation: The keys are isolated in the clipboard temporarily, limiting exposure.
- Immediate Inspection: You can directly paste and inspect the keys in Notepad++, without them ever touching the filesystem.
Prerequisites
- Windows 11 machine
- WireGuard utilities installed
- Notepad++ installed
Steps
-
Open Command Prompt
- Open a standard Command Prompt window. No need for admin privileges.
-
Generate Private Key and Copy to Clipboard
wg genkey | clip
This pipes the generated private key directly to the clipboard. -
Paste Private Key in Notepad++
- Open Notepad++.
- Paste the private key and save the file as
privatekey
(optional).
-
Generate Public Key
echo "<private_key_here>" | wg pubkey
Replace<private_key_here>
with the actual private key. This will display the public key in the console. -
Copy Public Key
- Manually select and copy the public key from the console output.
-
Paste Public Key in Notepad++
- Open a new tab in Notepad++.
- Paste the public key and save the file as
publickey
(optional).
Generating WireGuard Keys on Ubuntu Without Disk Writes
Why This Method?
- No Disk Writes: Keys aren't written to disk, reducing potential attack vectors.
- Clipboard Isolation: Temporarily holds the keys in the clipboard to minimize exposure.
- Immediate Inspection: Keys can be pasted into a text editor like
vim
ornano
for immediate inspection, never touching the filesystem.
Prerequisites
- Ubuntu machine
- WireGuard utilities installed (
sudo apt install wireguard-tools
) xclip
installed for clipboard operations (sudo apt install xclip
)
Steps
-
Open Terminal
Open a terminal window. No need for root privileges. -
Generate Private Key and Copy to Clipboard
wg genkey | xclip -selection clipboard
This command pipes the generated private key directly to the clipboard. -
Paste Private Key in Text Editor
- Open a text editor like
vim
ornano
. - Paste the private key (
Ctrl-Shift-V
in terminal) and save the file asprivatekey
if needed.
- Open a text editor like
-
Generate Public Key
echo "<private_key_here>" | wg pubkey
Replace<private_key_here>
with the actual private key. The corresponding public key will be displayed in the terminal. -
Copy Public Key
- Manually select and copy the public key from the terminal output.
-
Paste Public Key in Text Editor
- Open a new tab or window in your text editor.
- Paste the public key and save the file as
publickey
if needed.