Created
October 3, 2019 18:47
-
-
Save alxndr42/3f32b1b17e0aefa02a29e1bd4ac871eb to your computer and use it in GitHub Desktop.
Creates v3 hidden service authorization files.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
if [ $# -ne 2 ]; then | |
echo "Usage: tor-onion-auth <onion_address> <client_name>" | |
echo "" | |
echo "Creates v3 hidden service authorization files." | |
exit | |
fi | |
ONION_ADDRESS=$(echo $1 | sed -e 's/\.onion//') | |
CLIENT_NAME=$2 | |
PKEY=pkey.tmp | |
openssl genpkey -algorithm x25519 -out $PKEY | |
PRIVATE_KEY=$(openssl pkey -in $PKEY -outform DER | tail -c32 | base32 | tr -d '=') | |
PUBLIC_KEY=$(openssl pkey -in $PKEY -outform DER -pubout | tail -c32 | base32 | tr -d '=') | |
echo "$ONION_ADDRESS:descriptor:x25519:$PRIVATE_KEY" > "$CLIENT_NAME.auth_private" | |
echo "descriptor:x25519:$PUBLIC_KEY" > "$CLIENT_NAME.auth" | |
rm -f $PKEY |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment