Skip to content

Instantly share code, notes, and snippets.

@chigley
Created April 24, 2019 09:24
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save chigley/4cf95669c298ab7a4ab7b4438fb11aaf to your computer and use it in GitHub Desktop.
Save chigley/4cf95669c298ab7a4ab7b4438fb11aaf to your computer and use it in GitHub Desktop.
Generate Tor v3 hidden service authorised client files
#!/usr/bin/env bash
set -euo pipefail
if [ "$#" -ne 2 ]; then
echo "Usage: $0 onion client_name" >&2
exit 1
fi
onion=$(<<<"$1" sed 's/[.]onion$//')
declare -r onion
declare -r client_name=$2
priv=$(mktemp)
openssl genpkey -algorithm x25519 -out "$priv" -outform der
tor_priv=$(tail -c32 "$priv" | base32 | tr -d =)
declare -r tor_priv
tor_pub=$(openssl pkey -in "$priv" -inform der -pubout -outform der | tail -c32 | base32 | tr -d =)
declare -r tor_pub
rm -f "$priv"
echo "$client_name.auth: descriptor:x25519:$tor_pub"
echo "$client_name.auth_private: $onion:descriptor:x25519:$tor_priv"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment