Struct tor_llcrypto::pk::rsa::RsaIdentity
source · [−]pub struct RsaIdentity { /* private fields */ }
Expand description
An identifier for a Tor relay, based on its legacy RSA identity key. These are used all over the Tor protocol.
Note that for modern purposes, you should almost always identify a
relay by its Ed25519Identity
instead of by this kind of identity key.
Implementations
sourceimpl RsaIdentity
impl RsaIdentity
sourcepub fn as_bytes(&self) -> &[u8]ⓘNotable traits for &[u8]impl<'_> Read for &[u8]impl<'_> Write for &mut [u8]
pub fn as_bytes(&self) -> &[u8]ⓘNotable traits for &[u8]impl<'_> Read for &[u8]impl<'_> Write for &mut [u8]
Expose an RsaIdentity as a slice of bytes.
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
sourceimpl Clone for RsaIdentity
impl Clone for RsaIdentity
sourcefn clone(&self) -> RsaIdentity
fn clone(&self) -> RsaIdentity
Returns a copy of the value. Read more
1.0.0 · sourcefn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from source
. Read more
sourceimpl ConstantTimeEq for RsaIdentity
impl ConstantTimeEq for RsaIdentity
sourceimpl Debug for RsaIdentity
impl Debug for RsaIdentity
sourceimpl<'de> Deserialize<'de> for RsaIdentity
impl<'de> Deserialize<'de> for RsaIdentity
sourcefn 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
sourceimpl Display for RsaIdentity
impl Display for RsaIdentity
sourceimpl Hash for RsaIdentity
impl Hash for RsaIdentity
sourceimpl Ord for RsaIdentity
impl Ord for RsaIdentity
sourceimpl PartialEq<RsaIdentity> for RsaIdentity
impl PartialEq<RsaIdentity> for RsaIdentity
sourceimpl PartialOrd<RsaIdentity> for RsaIdentity
impl PartialOrd<RsaIdentity> for RsaIdentity
sourcefn partial_cmp(&self, other: &RsaIdentity) -> Option<Ordering>
fn partial_cmp(&self, other: &RsaIdentity) -> Option<Ordering>
This method returns an ordering between self
and other
values if one exists. Read more
1.0.0 · sourcefn lt(&self, other: &Rhs) -> bool
fn lt(&self, other: &Rhs) -> bool
This method tests less than (for self
and other
) and is used by the <
operator. Read more
1.0.0 · sourcefn le(&self, other: &Rhs) -> bool
fn le(&self, other: &Rhs) -> bool
This method tests less than or equal to (for self
and other
) and is used by the <=
operator. Read more
sourceimpl Serialize for RsaIdentity
impl Serialize for RsaIdentity
sourceimpl Zeroize for RsaIdentity
impl Zeroize for RsaIdentity
impl Copy for RsaIdentity
impl Eq for RsaIdentity
Auto Trait Implementations
impl RefUnwindSafe for RsaIdentity
impl Send for RsaIdentity
impl Sync for RsaIdentity
impl Unpin for RsaIdentity
impl UnwindSafe for RsaIdentity
Blanket Implementations
sourceimpl<T> BorrowMut<T> for T where
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
const: unstable · sourcefn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more