[tor-dev] adding smartcard support to Tor

s7r s7r at sky-ip.org
Sun Oct 18 00:31:17 UTC 2015

Hash: SHA256

Hello Razvan,

What you try to achieve is possible. It can be done, but requires code
to be written. If you are really interested about this feature you can
either sponsor someone to write the code for it either code it yourself.

The 1024 bit RSA private key (hidden service key) hosted in
HiddenServiceDir private_key file is used ONLY to sign descriptors
containing the introduction points for that hidden service. The signed
descriptors are then uploaded to the HSDirs responsible for that
hidden service at that time. Nothing more. This hidden service key has
nothing to do with the encrypted packets sent to that hidden service,
that is something different which is unrelated to the topic.

Here is how this could be done, in a very short example (10000 feet

1. Create a smartcard with your security parameters (password
protected or not, etc.), which can hold an encrypted 1024 bit RSA
private key and sign with it when requested.

2. Code Tor so that it can do the following:

2.1 - Can start without a private_key file in HiddenServiceDir, only
with a known hostname without exiting with fatal error. Currently, if
HiddenServiceDir is set, it won't start without this key and it will
create a new key there is none. A torrc setting like
'OfflineHiddenServiceKey 1' would make sense so Tor will know it needs
to behave differently when enabled. It will be 0 by default.

2.2 - Can normally choose and rotate introduction points as it wants
or needs to, but instead of signing the descriptors itself and
publishing them, just send the generated and unsigned descriptors via
ControlPort to another application or script.

2.3 - A separate application / script will take the unsigned
descriptors from Tor's ControlPort, access the smartcard, sign the
descriptors and return them to the Tor process the same - using
ControlPort, so that they can be published to the HSDirs. Make sure
the signing standard is respected as per Tor's specifications (bits,
encoding, format, etc.).

Easy to say, probably not so easy to implement. It will require a
proposal, code, some additional control port commands, probably other
stuff as well, but it is possible.

You can host the Tor instance handling the hidden service on another
server and do a VPN or SSH tunnel between that server and the server
having physical access to the smartcard, so they can talk to the
ControlPort as described above. Or you can connect the both servers
via other hidden services with authorization required so that each
servers remains anonymously from the other. You can let your
imagination go wild here and do plenty of things ...

Hope this helps.

On 10/18/2015 12:43 AM, Razvan Dragomirescu wrote:
> Ivan, according to
> https://www.torproject.org/docs/hidden-services.html.en (maybe I 
> misunderstood it), at Step 4, the client sends an _encrypted_
> packet to the hidden service, so the hidden service needs to be
> able to decrypt that packet. So the key on the card needs to be
> used both for signing the HS registration and for decrypting the
> packets during the initial handshake, isn't this correct?
> As far as I could tell, there is no way to tell Tor to use a
> smartcard in any phase of the protocol, your OnionBalance tool
> simply handles the registration by itself (outside of Tor).
> Regarding bandwidth, this is for an Internet of Things project,
> there's very little data going back and forth, I only plan to use
> the Tor network because it's a very good way of establishing point
> to point circuits in a decentralized manner. The alternative would
> be to use something like PubNub  or Amazon's new IoT service, but
> those would depend on PubNub/Amazon.
> Razvan
> -- Razvan Dragomirescu Chief Technology Officer Cayenne Graphics
Version: GnuPG v2.0.22 (MingW32)


More information about the tor-dev mailing list