Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

get_hidden_service_descriptor doesn't give a v3 descriptor #96

Open
atagar opened this issue Apr 18, 2021 · 3 comments
Open

get_hidden_service_descriptor doesn't give a v3 descriptor #96

atagar opened this issue Apr 18, 2021 · 3 comments

Comments

@atagar
Copy link
Contributor

atagar commented Apr 18, 2021

Stem's get_hidden_service_descriptor method can only retrieve v2 descriptors. Tor's HSFETCH added v3 support and Stem can parse v3 descriptors.

We should look into adding v3 support to the get_hidden_service_descriptor method.

@atagar
Copy link
Contributor Author

atagar commented Apr 19, 2021

Oh crap! My bad. On reflection since HSFETCH transparently works with v3 addresses and we go through the hidden_service's parse_file() method it looks like this already works. It's just a documentation and type hint fix.

@atagar atagar changed the title Download hidden service v3 descriptors Document that get_hidden_service_descriptor works with v3 Apr 19, 2021
@atagar
Copy link
Contributor Author

atagar commented Apr 19, 2021

I just double checked and yup, v3 works...

from stem.control import Controller

hs_address = 'jamie3vkiwibfiwucd6vxijskbhpjdyajmzeor4mc4i7yopvpo4p7cyd'

with Controller.from_port() as controller:
  controller.authenticate()
  print(controller.get_hidden_service_descriptor(hs_address))
% python demo.py 
hs-descriptor 3
descriptor-lifetime 180
descriptor-signing-key-cert
-----BEGIN ED25519 CERT-----
AQgABtzLAarUntf8SWwGyISIuPimU/DMpNSRhpY1B89ng3lk+qGpAQAgBACy/m0a
njtbQIsFvTulLeEJpx8XJhPppYbKNuE3qoa5AdiHacO7a+QZlz6Km2fvkftv4Hzh
2o9y8af1AwyGBWu8+BNCDeZy9UikdGQ/4Xr6L6jNeq0b9hn2hko0O7WvdA8=
-----END ED25519 CERT-----
revision-counter 2441650557
superencrypted
-----BEGIN MESSAGE-----
ADWK6fzIy4FMUuZqPJXV3A+6BM90LOIRS0JpBNw9frMeQ3SrBZWYU91o5iv9rvTs
/hoHCTXXEoXMm9m2PfeqCPXQ10i8DlEU2KWOCGMSgbhC5XBc+6DH/kSddHQpmYRE
...

@atagar atagar changed the title Document that get_hidden_service_descriptor works with v3 get_hidden_service_descriptor doesn't give a v3 descriptor Dec 6, 2021
@atagar
Copy link
Contributor Author

atagar commented Dec 6, 2021

Oops, a good catch from Zanella. Our get_hidden_service_descriptor method always provides a HiddenServiceDescriptorV2 object, even if we fetch a v3 descriptor. As a result none the attributes and decrypt method are unavailable.

You can work around this by re-casting the descriptor to be v3 as demonstrated below but this is clearly a bug.

from stem.control import Controller
from stem.descriptor.hidden_service import HiddenServiceDescriptorV3

hs_address = 'duckduckgogg42xjoc72x3sjasowoarfbgcmvfimaftt6twagswzczad'

with Controller.from_port() as controller:
  controller.authenticate()
  desc = controller.get_hidden_service_descriptor(hs_address)  # mistakenly a HSv2 descriptor

  desc = HiddenServiceDescriptorV3.from_str(str(desc))  # reparse as HSv3
  print(desc.decrypt(hs_address))
% python demo.py 
create2-formats 2
single-onion-service
introduction-point AwAGBU9PhQG7AhTQedaBiSZoTFl5wYFx+xiGKkpXkgMgrdXXiaF5xMfwqN/DAku/4xLnD76R/GpX1jVqoj9BwE4=
onion-key ntor PjkfSiy4fTfOMsmvmWCi354KIpblSkx+NLckhiHAMmA=
auth-key
-----BEGIN ED25519 CERT-----
AQkABvJzAdaXk/sl0u1zOYSYVNkbnDDwiPWmML29DOhOC3mY6dnoAQAgBABYw6hG
/Veqwtja4D+ivGK3xWSTiqdHCvaKlVzd8dCRo/2Srdg+uja7Y2ZLvxeQRb1uvbPs

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant