0

Suppose in my node.js app I have a 1024bit RSA key pair., I hashed the public key and derive .onion addres from the hash.

Is it possible to register this exact keypair and the hostname as a hidden service? and if so - how? I assume that steps wuld be creating a hidden service folder in /var/lib/tor, placing there hostname and privateKey files, and adding this service in torrc... But where to put the public key? should I put signature of the folder? any other steps I am missing?

Thank you!

1

The easiest method is to create a vanilla onion service, e.g.:

HiddenServiceDir /var/lib/tor/onion
HiddenServicePort 80

Then start the tor service, let it finish loading, then stop the tor service.

Now edit the file /var/lib/tor/onion/private_key and replace the private key in the file with the one you've generated and save the file, then start Tor.

The public key isn't needed since the private key already contains all the information that the public key does.

Now when you start the tor service again, you should see your custom hostname has been written to the /var/lib/tor/onion/hostname file (where it previously had the one Tor generated for you).

The reason I'd recommend this path is that Tor is picky about permissions on the files and folders, to ensure that only the user tor is running as can read the keys, so this lets tor create the files and folder with the right permissions for you. All you need to do is replace the contents of the private_key file.

The RSA private key should be stored in PEM format.

  • This is likely a duplicate but I couldn't find one that was specific enough to be a direct answer. If you see a duplicate of this, please flag it up. – cacahuatl Feb 6 '18 at 17:38

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.