Months ago asn asked us for this but I said 'not until tor provides a way of actually... well, getting it'. With #14847 (moved) this is now becoming a thing so it's time stem provided a parser.
David, would you mind adding an example to this ticket for what a hs descriptor in the wild looks like? I'll use it for stem's unit test.
To upload designs, you'll need to enable LFS and have an admin enable hashed storage. More information
Child items ...
Show closed items
Linked items 0
Link issues together to show that they're related.
Learn more.
Months ago asn asked us for this but I said 'not until tor provides a way of actually... well, getting it'. With #14847 (moved) this is now becoming a thing so it's time stem provided a parser.
David, would you mind adding an example to this ticket for what a hs descriptor in the wild looks like? I'll use it for stem's unit test.
Here it is, a duckduckgo hs descriptor (3g2upl4pq6kufc4m.onion)
The "introduction-points" part is base64 encoded.
rendezvous-service-descriptor y3olqqblqw2gbh6phimfuiroechjjafaversion 2permanent-key-----BEGIN RSA PUBLIC KEY-----MIGJAoGBAJ/SzzgrXPxTlFrKVhXh3buCWv2QfcNgncUpDpKouLn3AtPH5Ocys0jEaZSKdvaiQ62md2gOwj4x61cFNdi05tdQjS+2thHKEm/KsB9BGLSLBNJYY356bupgI5gQozM65ENelfxYlysBjJ52xSDBd8C4f/p9umdzaaaCmzXG/nhzAgMBAAE=-----END RSA PUBLIC KEY-----secret-id-part e24kgecavwsznj7gpbktqsiwgvngsf4epublication-time 2015-02-23 20:00:00protocol-versions 2,3introduction-points-----BEGIN MESSAGE-----aW50cm9kdWN0aW9uLXBvaW50IGl3a2k3N3h0YnZwNnF2ZWRmcndkem5jeHMzY2theWV1CmlwLWFkZHJlc3MgMTc4LjYyLjIyMi4xMjkKb25pb24tcG9ydCA0NDMKb25pb24ta2V5Ci0tLS0tQkVHSU4gUlNBIFBVQkxJQyBLRVktLS0tLQpNSUdKQW9HQkFLOTRCRVlJSFo0S2RFa2V5UGhiTENwUlc1RVNnKzJXUFFock00eXVLWUd1cTh3RldndW1aWVI5CmsvV0EvL0ZZWE1CejBiQitja3Vacy9ZdTluSytITHpwR2FwVjBjbHN0NEdVTWNCSW5VQ3pDY3BqSlRRc1FEZ20KMy9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QyBLRVktLS0tLQoK-----END MESSAGE-----signature-----BEGIN SIGNATURE-----VKMmsDIUUFOrpqvcQroIZjDZTKxqNs88a4M9Te8cR/ZvS7H2nffv6iQs0tom5X4D4Dy4iZiy+pwYxdHfaOxmdpgMCRvgPb34MExWr5YemH0QuGtnlp5Wxr8GYaAQVuZXcZjQLW0juUYCbgIGdxVEBnlEt2rgBSM9+1oR7EAfV1U=-----END SIGNATURE-----
At this point ball's back in your court. To proceed I need an example of a hidden service descriptor that has an encrypted introductory-points, and the cookie to decrypt it. Bonus points if you also have a python snippet that exemplifies how to decrypt it. :)
Snippets of code for calculating Tor hidden service descriptor values
The onion address isn't part of the descriptor, but other than that I suspect it would be nice to add some of those checks to our unit tests or validation. Patch welcome. :P
Nice work on getting the hidden service descriptor parsing merged into stem. I've implemented the decryption of basic and stealth type encrypted introduction points. The updated code is on Github and I have attached it to the ticket. Hope that helps!
One additional piece of test data I'd appreciate is a hidden service descriptor that's encrypted but has service-authentication lines.
According to the spec the descriptor can have encrypted introduction-points prefixed with those lines in plaintext. Our present implementation should support that but presently we lack any test coverage for it. This is kinda odd behavior so it would be a good thing to have a test for.
Perfect! I've just had a look at the code and it doesn't look like the 'service-authentication' field is actually implemented in Tor. Is this an out-of-date reference in the rend-spec. Was 'service-authentication' implemented in tor previously?
Both tests raise TypeErrors caused by the hex conversion going wrong. The patch uses a different method for hex conversion which does not raise TypeErrors.
The raised DecryptionFailure on ValueError still misses some slicing. The patch would be;
diff --git a/stem/descriptor/hidden_service_descriptor.py b/stem/descriptor/hidden_service_descriptor.pyindex 8c3ce7d..b0a9551 100644--- a/stem/descriptor/hidden_service_descriptor.py+++ b/stem/descriptor/hidden_service_descriptor.py@@ -317,7 +317,7 @@ class HiddenServiceDescriptor(Descriptor): try: client_blocks = int(binascii.hexlify(content[1:2]), 16) except ValueError:- raise DecryptionFailure("When using basic auth the content should start with a number of blocks but wasn't a hex digit: %s" % binascii.hexlify(content[1]))+ raise DecryptionFailure("When using basic auth the content should start with a number of blocks but wasn't a hex digit: %s" % binascii.hexlify(content[1:2])) # parse the client id and encrypted session keys