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

  1. Open Command Prompt
    • Open a standard Command Prompt window. No need for admin privileges.
  2. Generate Private Key and Copy to Clipboard
    wg genkey | clip
    This pipes the generated private key directly to the clipboard.
  3. Paste Private Key in Notepad++
    • Open Notepad++.
    • Paste the private key and save the file as privatekey (optional).
  4. 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.
  5. Copy Public Key
    • Manually select and copy the public key from the console output.
  6. 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 or nano 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

  1. Open Terminal
    Open a terminal window. No need for root privileges.
  2. Generate Private Key and Copy to Clipboard
    wg genkey | xclip -selection clipboard
    This command pipes the generated private key directly to the clipboard.
  3. Paste Private Key in Text Editor
    • Open a text editor like vim or nano.
    • Paste the private key (Ctrl-Shift-V in terminal) and save the file as privatekey if needed.
  4. 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.
  5. Copy Public Key
    • Manually select and copy the public key from the terminal output.
  6. 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.
Why not pipe the pub key output to the clipboard like you did the private key?
reply