pub struct HiddenServiceDescriptorV2 {
pub descriptor_id: String,
pub version: u32,
pub permanent_key: Option<String>,
pub secret_id_part: String,
pub published: DateTime<Utc>,
pub protocol_versions: Vec<u32>,
pub introduction_points_encoded: Option<String>,
pub introduction_points_content: Option<Vec<u8>>,
pub signature: String,
/* private fields */
}Expand description
Version 2 hidden service descriptor.
A v2 hidden service descriptor contains all the information needed for clients to connect to a hidden service using the v2 protocol. This includes the service’s public key, publication time, supported protocol versions, and encrypted introduction points.
§Deprecation Notice
Version 2 hidden services are deprecated and being phased out by the Tor
Project. New services should use version 3 descriptors
(HiddenServiceDescriptorV3) which provide stronger cryptography.
§Structure
The descriptor contains:
descriptor_id: Unique identifier (base32 hash of service key and time)permanent_key: RSA-1024 public key of the hidden servicesecret_id_part: Hash component for descriptor ID validationpublished: When this descriptor was createdprotocol_versions: Supported rendezvous protocol versions (typically 2,3)introduction_points_*: Encrypted or encoded introduction point datasignature: RSA signature over the descriptor
§Introduction Points
Introduction points may be encrypted if the service uses client
authorization. Use introduction_points()
to decode them when unencrypted.
§Example
use stem_rs::descriptor::hidden::HiddenServiceDescriptorV2;
use stem_rs::descriptor::Descriptor;
let content = std::fs::read_to_string("descriptor.txt")?;
let desc = HiddenServiceDescriptorV2::parse(&content)?;
println!("Descriptor ID: {}", desc.descriptor_id);
println!("Published: {}", desc.published);
println!("Protocol versions: {:?}", desc.protocol_versions);
// Get introduction points (if not encrypted)
if let Ok(points) = desc.introduction_points() {
for point in points {
println!("Intro point: {} at {}:{}",
point.identifier, point.address, point.port);
}
}§Security
- The
permanent_keyis the long-term identity of the service - The
signatureshould be verified againstpermanent_key - Introduction points may be encrypted for client authorization
Fields§
§descriptor_id: StringUnique identifier for this descriptor (base32-encoded hash).
version: u32Hidden service descriptor version (always 2 for this type).
permanent_key: Option<String>RSA-1024 public key of the hidden service (PEM format).
secret_id_part: StringHash of time period, cookie, and replica for descriptor ID validation.
published: DateTime<Utc>UTC timestamp when this descriptor was published.
protocol_versions: Vec<u32>List of supported rendezvous protocol versions (typically [2, 3]).
introduction_points_encoded: Option<String>Raw base64-encoded introduction points blob (MESSAGE block).
introduction_points_content: Option<Vec<u8>>Decoded introduction points content (may be encrypted).
signature: StringRSA signature over the descriptor content (PEM format).
Implementations§
Source§impl HiddenServiceDescriptorV2
impl HiddenServiceDescriptorV2
Sourcepub fn introduction_points(&self) -> Result<Vec<IntroductionPointV2>, Error>
pub fn introduction_points(&self) -> Result<Vec<IntroductionPointV2>, Error>
Decodes and parses the introduction points from this descriptor.
Introduction points are act as intermediaries between clients and the hidden service. This method decodes the base64-encoded introduction points blob and parses each introduction point.
§Returns
A vector of IntroductionPointV2 on success, or an empty vector
if no introduction points are present.
§Errors
Returns Error::Parse if:
- The introduction points content is not valid UTF-8
- The content is encrypted (starts with something other than “introduction-point “)
- Individual introduction points fail to parse
§Example
let desc = HiddenServiceDescriptorV2::parse(content)?;
leo_points = desc.introduction_points()?;
for point in intro_points {
println!("Relay: {} at {}:{}",
point.identifier, point.address, point.port);
}§Security
If the hidden service uses client authorization, the introduction points will be encrypted and this method will return an error. Decryption requires the client’s authorization cookie.
Trait Implementations§
Source§impl Clone for HiddenServiceDescriptorV2
impl Clone for HiddenServiceDescriptorV2
Source§fn clone(&self) -> HiddenServiceDescriptorV2
fn clone(&self) -> HiddenServiceDescriptorV2
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more