CertType

Enum CertType 

Source
pub enum CertType {
    Link = 1,
    Identity = 2,
    Authenticate = 3,
    Ed25519Signing = 4,
    LinkCert = 5,
    Ed25519Authenticate = 6,
    Ed25519Identity = 7,
    HsV3DescSigning = 8,
    HsV3IntroAuth = 9,
    NtorOnionKey = 10,
    HsV3NtorEnc = 11,
    Unknown = 12,
}
Expand description

Certificate type identifier.

Identifies the purpose of a certificate in the Tor protocol. Different certificate types are used for different authentication and signing purposes.

For more information, see:

§Variants

VariantValueDescription
Link1Link key certificate (RSA1024 identity)
Identity2RSA1024 identity certificate
Authenticate3RSA1024 AUTHENTICATE cell link certificate
Ed25519Signing4Ed25519 signing key (signed with identity)
LinkCert5TLS link cert (signed with Ed25519 signing)
Ed25519Authenticate6Ed25519 AUTHENTICATE cell key
Ed25519Identity7Ed25519 identity (signed with RSA identity)
HsV3DescSigning8HS v3 short-term descriptor signing key
HsV3IntroAuth9HS v3 introduction point authentication key
NtorOnionKey10ntor onion key cross-certifying Ed25519
HsV3NtorEnc11HS v3 ntor-extra encryption key
Unknown-Unrecognized certificate type

§Example

use stem_rs::client::datatype::CertType;

let (cert_type, raw) = CertType::get(4);
assert_eq!(cert_type, CertType::Ed25519Signing);
assert_eq!(format!("{}", cert_type), "ED25519_SIGNING");

Variants§

Link key certificate certified by RSA1024 identity.

§

Identity = 2

RSA1024 identity certificate.

§

Authenticate = 3

RSA1024 AUTHENTICATE cell link certificate.

§

Ed25519Signing = 4

Ed25519 signing key, signed with identity key.

§

LinkCert = 5

TLS link certificate, signed with Ed25519 signing key.

§

Ed25519Authenticate = 6

Ed25519 AUTHENTICATE cell key, signed with Ed25519 signing key.

§

Ed25519Identity = 7

Ed25519 identity, signed with RSA identity.

§

HsV3DescSigning = 8

Hidden service v3 short-term descriptor signing key.

§

HsV3IntroAuth = 9

Hidden service v3 introduction point authentication key.

§

NtorOnionKey = 10

ntor onion key cross-certifying Ed25519 identity key.

§

HsV3NtorEnc = 11

Hidden service v3 ntor-extra encryption key.

§

Unknown = 12

Unrecognized certificate type.

Implementations§

Source§

impl CertType

Source

pub fn get(val: u8) -> (CertType, u8)

Converts a raw byte value to a CertType and its integer representation.

§Arguments
  • val - The raw certificate type byte from the protocol
§Returns

A tuple of (CertType, u8) where the second element is the original byte value. This preserves unknown type values for round-tripping.

Source

pub fn value(&self) -> u8

Returns the integer value for this certificate type.

Returns 255 for Unknown types.

Trait Implementations§

Source§

impl Clone for CertType

Source§

fn clone(&self) -> CertType

Returns a duplicate of the value. Read more
1.0.0 · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for CertType

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Display for CertType

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the certificate type as its canonical string name.

Source§

impl Hash for CertType

Source§

fn hash<__H: Hasher>(&self, state: &mut __H)

Feeds this value into the given Hasher. Read more
1.3.0 · Source§

fn hash_slice<H>(data: &[Self], state: &mut H)
where H: Hasher, Self: Sized,

Feeds a slice of this type into the given Hasher. Read more
Source§

impl PartialEq for CertType

Source§

fn eq(&self, other: &CertType) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 · Source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
Source§

impl Copy for CertType

Source§

impl Eq for CertType

Source§

impl StructuralPartialEq for CertType

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T> ToString for T
where T: Display + ?Sized,

Source§

fn to_string(&self) -> String

Converts the given value to a String. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.