pub struct RsaIdentity { /* private fields */ }
Expand description
An identifier for an RSA key, based on SHA1 and DER.
These are used (for legacy purposes) all over the Tor protocol.
This object is an “identity” in the sense that it identifies (up to) one RSA key. It may also represent the identity for a particular entity, such as a relay or a directory authority.
Note that for modern purposes, you should almost always identify a relay by
its Ed25519Identity
instead of by
this kind of identity key.
Implementations§
Source§impl RsaIdentity
impl RsaIdentity
Sourcepub fn from_bytes(bytes: &[u8]) -> Option<Self>
pub fn from_bytes(bytes: &[u8]) -> Option<Self>
Construct an RsaIdentity from a slice of bytes.
Returns None if the input is not of the correct length.
use tor_llcrypto::pk::rsa::RsaIdentity;
let bytes = b"xyzzyxyzzyxyzzyxyzzy";
let id = RsaIdentity::from_bytes(bytes);
assert_eq!(id.unwrap().as_bytes(), bytes);
let truncated = b"xyzzy";
let id = RsaIdentity::from_bytes(truncated);
assert_eq!(id, None);
Trait Implementations§
Source§impl Clone for RsaIdentity
impl Clone for RsaIdentity
Source§fn clone(&self) -> RsaIdentity
fn clone(&self) -> RsaIdentity
Returns a copy of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source
. Read moreSource§impl ConstantTimeEq for RsaIdentity
impl ConstantTimeEq for RsaIdentity
Source§impl Debug for RsaIdentity
impl Debug for RsaIdentity
Source§impl<'de> Deserialize<'de> for RsaIdentity
impl<'de> Deserialize<'de> for RsaIdentity
Source§fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>where
D: Deserializer<'de>,
fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>where
D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
Source§impl Display for RsaIdentity
impl Display for RsaIdentity
Source§impl HasMemoryCostStructural for RsaIdentity
impl HasMemoryCostStructural for RsaIdentity
Source§fn indirect_memory_cost(&self, et: EnabledToken) -> usize
fn indirect_memory_cost(&self, et: EnabledToken) -> usize
Memory cost of data stored out-of-line Read more
Source§impl Hash for RsaIdentity
impl Hash for RsaIdentity
Source§impl Ord for RsaIdentity
impl Ord for RsaIdentity
Source§fn cmp(&self, other: &RsaIdentity) -> Ordering
fn cmp(&self, other: &RsaIdentity) -> Ordering
1.21.0 · Source§fn max(self, other: Self) -> Selfwhere
Self: Sized,
fn max(self, other: Self) -> Selfwhere
Self: Sized,
Compares and returns the maximum of two values. Read more
Source§impl PartialEq for RsaIdentity
impl PartialEq for RsaIdentity
Source§impl PartialOrd for RsaIdentity
impl PartialOrd for RsaIdentity
Source§impl Redactable for RsaIdentity
impl Redactable for RsaIdentity
Source§fn display_redacted(&self, f: &mut Formatter<'_>) -> Result
fn display_redacted(&self, f: &mut Formatter<'_>) -> Result
Warning: This displays 16 bits of the RSA identity, which is enough to narrow down a public relay by a great deal.
Source§fn debug_redacted(&self, f: &mut Formatter<'_>) -> Result
fn debug_redacted(&self, f: &mut Formatter<'_>) -> Result
As
Debug::fmt
, but produce a redacted representation.Source§fn redacted(&self) -> Redacted<&Self>
fn redacted(&self) -> Redacted<&Self>
Return a smart pointer that will display or debug this object as its
redacted form.
Source§fn maybe_redacted(&self, redact: bool) -> MaybeRedacted<&Self>
fn maybe_redacted(&self, redact: bool) -> MaybeRedacted<&Self>
Return a smart pointer that redacts this object if
redact
is true.Source§impl Serialize for RsaIdentity
impl Serialize for RsaIdentity
impl Copy for RsaIdentity
impl Eq for RsaIdentity
impl StructuralPartialEq for RsaIdentity
Auto Trait Implementations§
impl Freeze for RsaIdentity
impl RefUnwindSafe for RsaIdentity
impl Send for RsaIdentity
impl Sync for RsaIdentity
impl Unpin for RsaIdentity
impl UnwindSafe for RsaIdentity
Blanket Implementations§
§impl<'a, T, E> AsTaggedExplicit<'a, E> for Twhere
T: 'a,
impl<'a, T, E> AsTaggedExplicit<'a, E> for Twhere
T: 'a,
§impl<'a, T, E> AsTaggedImplicit<'a, E> for Twhere
T: 'a,
impl<'a, T, E> AsTaggedImplicit<'a, E> for Twhere
T: 'a,
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
§impl<Q, K> Comparable<K> for Q
impl<Q, K> Comparable<K> for Q
§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
Checks if this value is equivalent to the given key. Read more
§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
Compare self to
key
and return true
if they are equal.Source§impl<T> HasMemoryCost for Twhere
T: HasMemoryCostStructural,
impl<T> HasMemoryCost for Twhere
T: HasMemoryCostStructural,
Source§fn memory_cost(&self, et: EnabledToken) -> usize
fn memory_cost(&self, et: EnabledToken) -> usize
Returns the memory cost of
self
, in bytes Read moreSource§impl<T> HasTypedMemoryCost<T> for Twhere
T: HasMemoryCost,
impl<T> HasTypedMemoryCost<T> for Twhere
T: HasMemoryCost,
Source§fn typed_memory_cost(&self, enabled: EnabledToken) -> TypedMemoryCost<T>
fn typed_memory_cost(&self, enabled: EnabledToken) -> TypedMemoryCost<T>
The cost, as a
TypedMemoryCost<T>
rather than a raw usize
§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self
into a Left
variant of Either<Self, Self>
if into_left
is true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self
into a Left
variant of Either<Self, Self>
if into_left(&self)
returns true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read more