<div dir="ltr">Thank you s7r! I think I'm going to start by simply using a mechanism similar to OnionBalance - I'm going to let Tor do its HS registration with a random HS name (and with a key that the host knows), then read the introduction points and keys and re-register them (a la OnionBalance) with a new HS name corresponding to the private key on the card. If I understand this correctly, this will make the hidden service accessible both on the random name and on the one the card knows the key to.<div><br></div><div>This way I don't have to modify Tor at all - I just let it do its thing, then re-register out of band, like OnionBalance does. I just do it from the same host instead of a frontend machine and I do it by signing with the smartcard key (and generating the name based on that).</div><div><br></div><div>Thanks again,</div><div>Razvan</div><div><br></div><div>--</div><div>Razvan Dragomirescu</div><div>Chief Technology Officer</div><div>Cayenne Graphics SRL</div></div><div class="gmail_extra"><br><div class="gmail_quote">On Sun, Oct 18, 2015 at 3:31 AM, s7r <span dir="ltr"><<a href="mailto:s7r@sky-ip.org" target="_blank">s7r@sky-ip.org</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">-----BEGIN PGP SIGNED MESSAGE-----<br>
Hash: SHA256<br>
<br>
Hello Razvan,<br>
<br>
What you try to achieve is possible. It can be done, but requires code<br>
to be written. If you are really interested about this feature you can<br>
either sponsor someone to write the code for it either code it yourself.<br>
<br>
The 1024 bit RSA private key (hidden service key) hosted in<br>
HiddenServiceDir private_key file is used ONLY to sign descriptors<br>
containing the introduction points for that hidden service. The signed<br>
descriptors are then uploaded to the HSDirs responsible for that<br>
hidden service at that time. Nothing more. This hidden service key has<br>
nothing to do with the encrypted packets sent to that hidden service,<br>
that is something different which is unrelated to the topic.<br>
<br>
Here is how this could be done, in a very short example (10000 feet<br>
overview):<br>
<br>
1. Create a smartcard with your security parameters (password<br>
protected or not, etc.), which can hold an encrypted 1024 bit RSA<br>
private key and sign with it when requested.<br>
<br>
2. Code Tor so that it can do the following:<br>
<br>
2.1 - Can start without a private_key file in HiddenServiceDir, only<br>
with a known hostname without exiting with fatal error. Currently, if<br>
HiddenServiceDir is set, it won't start without this key and it will<br>
create a new key there is none. A torrc setting like<br>
'OfflineHiddenServiceKey 1' would make sense so Tor will know it needs<br>
to behave differently when enabled. It will be 0 by default.<br>
<br>
2.2 - Can normally choose and rotate introduction points as it wants<br>
or needs to, but instead of signing the descriptors itself and<br>
publishing them, just send the generated and unsigned descriptors via<br>
ControlPort to another application or script.<br>
<br>
2.3 - A separate application / script will take the unsigned<br>
descriptors from Tor's ControlPort, access the smartcard, sign the<br>
descriptors and return them to the Tor process the same - using<br>
ControlPort, so that they can be published to the HSDirs. Make sure<br>
the signing standard is respected as per Tor's specifications (bits,<br>
encoding, format, etc.).<br>
<br>
Easy to say, probably not so easy to implement. It will require a<br>
proposal, code, some additional control port commands, probably other<br>
stuff as well, but it is possible.<br>
<br>
You can host the Tor instance handling the hidden service on another<br>
server and do a VPN or SSH tunnel between that server and the server<br>
having physical access to the smartcard, so they can talk to the<br>
ControlPort as described above. Or you can connect the both servers<br>
via other hidden services with authorization required so that each<br>
servers remains anonymously from the other. You can let your<br>
imagination go wild here and do plenty of things ...<br>
<br>
Hope this helps.<br>
<span class=""><br>
<br>
On 10/18/2015 12:43 AM, Razvan Dragomirescu wrote:<br>
> Ivan, according to<br>
> <a href="https://www.torproject.org/docs/hidden-services.html.en" rel="noreferrer" target="_blank">https://www.torproject.org/docs/hidden-services.html.en</a> (maybe I<br>
> misunderstood it), at Step 4, the client sends an _encrypted_<br>
> packet to the hidden service, so the hidden service needs to be<br>
> able to decrypt that packet. So the key on the card needs to be<br>
> used both for signing the HS registration and for decrypting the<br>
> packets during the initial handshake, isn't this correct?<br>
><br>
> As far as I could tell, there is no way to tell Tor to use a<br>
> smartcard in any phase of the protocol, your OnionBalance tool<br>
> simply handles the registration by itself (outside of Tor).<br>
><br>
> Regarding bandwidth, this is for an Internet of Things project,<br>
> there's very little data going back and forth, I only plan to use<br>
> the Tor network because it's a very good way of establishing point<br>
> to point circuits in a decentralized manner. The alternative would<br>
> be to use something like PubNub  or Amazon's new IoT service, but<br>
> those would depend on PubNub/Amazon.<br>
><br>
> Razvan<br>
><br>
> -- Razvan Dragomirescu Chief Technology Officer Cayenne Graphics<br>
> SRL<br>
><br>
</span>-----BEGIN PGP SIGNATURE-----<br>
Version: GnuPG v2.0.22 (MingW32)<br>
<br>
iQEcBAEBCAAGBQJWIuhVAAoJEIN/pSyBJlsR65MIAIvtJWhU2eJTTgkadYuJxtyj<br>
6of4hpPCI7R9WBdcaIE/Z3fKSzdOqcLKgeHyge6WlKNmNZE+hmzzwMl4aK4DywVW<br>
gHdtI0I0sYd95plbAPWCT+ViZra5dsW50avbRMMgQ7jntihpZxziHKePviKd8Ps6<br>
G8U/XeCDtz60MCI9EK+BlL2ufoK2f1VH7GEIWY5DcsLpOb41w+Mr/jSoH1vZVaQz<br>
KuTGB5xsZte+GCd1prYKszzZeRLdjFaInrXO0f0dza/UCaZMQfJuCDCQoksPQn26<br>
szolqTqFcbcWUaBDjvEwuR5p3Og3CU+weJJyETP0OAx++Rd28oy75IpkJLnhQms=<br>
=0vbe<br>
-----END PGP SIGNATURE-----<br>
<div class="HOEnZb"><div class="h5">_______________________________________________<br>
tor-dev mailing list<br>
<a href="mailto:tor-dev@lists.torproject.org">tor-dev@lists.torproject.org</a><br>
<a href="https://lists.torproject.org/cgi-bin/mailman/listinfo/tor-dev" rel="noreferrer" target="_blank">https://lists.torproject.org/cgi-bin/mailman/listinfo/tor-dev</a><br>
</div></div></blockquote></div><br></div>