Struct rpki::crypto::keys::KeyIdentifier

source ·
pub struct KeyIdentifier(/* private fields */);
Expand description

A key identifier.

This is the SHA-1 hash over the public key’s bits.

Implementations§

source§

impl KeyIdentifier

source

pub fn as_slice(&self) -> &[u8]

Returns an octet slice of the key identifer’s value.

source

pub fn into_hex(self) -> [u8; 40]

Returns a octet array with the hex representation of the identifier.

source§

impl KeyIdentifier

source

pub fn take_from<S: Source>( cons: &mut Constructed<'_, S> ) -> Result<Self, DecodeError<S::Error>>

Takes an encoded key identifier from a constructed value.

KeyIdentifier ::= OCTET STRING

The content of the octet string needs to be a SHA-1 hash, so it must be exactly 20 octets long.

source

pub fn take_opt_from<S: Source>( cons: &mut Constructed<'_, S> ) -> Result<Option<Self>, DecodeError<S::Error>>

source

pub fn from_content<S: Source>( content: &mut Content<'_, S> ) -> Result<Self, DecodeError<S::Error>>

Parses an encoded key identifer from encoded content.

source

pub fn skip_opt_in<S: Source>( cons: &mut Constructed<'_, S> ) -> Result<Option<()>, DecodeError<S::Error>>

Skips over an encoded key indentifier.

Trait Implementations§

source§

impl<'arbitrary> Arbitrary<'arbitrary> for KeyIdentifier

source§

fn arbitrary(u: &mut Unstructured<'arbitrary>) -> Result<Self>

Generate an arbitrary value of Self from the given unstructured data. Read more
source§

fn arbitrary_take_rest(u: Unstructured<'arbitrary>) -> Result<Self>

Generate an arbitrary value of Self from the entirety of the given unstructured data. Read more
source§

fn size_hint(depth: usize) -> (usize, Option<usize>)

Get a size hint for how many bytes out of an Unstructured this type needs to construct itself. Read more
source§

impl AsRef<[u8]> for KeyIdentifier

source§

fn as_ref(&self) -> &[u8]

Converts this type into a shared reference of the (usually inferred) input type.
source§

impl Clone for KeyIdentifier

source§

fn clone(&self) -> KeyIdentifier

Returns a copy 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 KeyIdentifier

source§

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

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

impl<'de> Deserialize<'de> for KeyIdentifier

source§

fn deserialize<D: Deserializer<'de>>(deserializer: D) -> Result<Self, D::Error>

Deserialize this value from the given Serde deserializer. Read more
source§

impl Display for KeyIdentifier

source§

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

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

impl From<[u8; 20]> for KeyIdentifier

source§

fn from(src: [u8; 20]) -> Self

Converts to this type from the input type.
source§

impl From<KeyIdentifier> for [u8; 20]

source§

fn from(src: KeyIdentifier) -> Self

Converts to this type from the input type.
source§

impl FromStr for KeyIdentifier

§

type Err = ParseKeyIdentifierError

The associated error which can be returned from parsing.
source§

fn from_str(value: &str) -> Result<Self, Self::Err>

Parses a string s to return a value of this type. Read more
source§

impl Hash for KeyIdentifier

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 Ord for KeyIdentifier

source§

fn cmp(&self, other: &KeyIdentifier) -> Ordering

This method returns an Ordering between self and other. Read more
1.21.0 · source§

fn max(self, other: Self) -> Self
where Self: Sized,

Compares and returns the maximum of two values. Read more
1.21.0 · source§

fn min(self, other: Self) -> Self
where Self: Sized,

Compares and returns the minimum of two values. Read more
1.50.0 · source§

fn clamp(self, min: Self, max: Self) -> Self
where Self: Sized + PartialOrd,

Restrict a value to a certain interval. Read more
source§

impl<T: AsRef<[u8]>> PartialEq<T> for KeyIdentifier

source§

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

This method tests for self and other values to be equal, and is used by ==.
1.0.0 · source§

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

This method tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
source§

impl PartialOrd for KeyIdentifier

source§

fn partial_cmp(&self, other: &KeyIdentifier) -> Option<Ordering>

This method returns an ordering between self and other values if one exists. Read more
1.0.0 · source§

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 · source§

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
1.0.0 · source§

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

This method tests greater than (for self and other) and is used by the > operator. Read more
1.0.0 · source§

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

This method tests greater than or equal to (for self and other) and is used by the >= operator. Read more
source§

impl PrimitiveContent for KeyIdentifier

source§

const TAG: Tag = bcder::Tag::OCTET_STRING

The natural tag of an encoded value of this type.
source§

fn encoded_len(&self, _mode: Mode) -> usize

Returns the length of the encoded content of this type.
source§

fn write_encoded<W: Write>( &self, _mode: Mode, target: &mut W ) -> Result<(), Error>

Writes the encoded content to a writer.
source§

fn to_encoded_bytes(&self, mode: Mode) -> Bytes

Encodes the value to bytes (useful when you need to sign a structure)
source§

fn encode(self) -> Primitive<Self>

Returns a value encoder for this content using the natural tag. Read more
source§

fn encode_as(self, tag: Tag) -> Primitive<Self>

Returns a value encoder for this content using the given tag. Read more
source§

fn encode_ref(&self) -> Primitive<&Self>

Returns a value encoder for a reference using the natural tag.
source§

fn encode_ref_as(&self, tag: Tag) -> Primitive<&Self>

Returns a value encoder for a reference using the given tag.
source§

impl Serialize for KeyIdentifier

source§

fn serialize<S: Serializer>(&self, serializer: S) -> Result<S::Ok, S::Error>

Serialize this value into the given Serde serializer. Read more
source§

impl<'a> TryFrom<&'a [u8]> for KeyIdentifier

§

type Error = KeyIdentifierSliceError

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

fn try_from(value: &'a [u8]) -> Result<Self, Self::Error>

Performs the conversion.
source§

impl Copy for KeyIdentifier

source§

impl Eq for KeyIdentifier

source§

impl StructuralEq for KeyIdentifier

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> 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> Text for T
where T: Display,

source§

fn write_escaped( &self, mode: TextEscape, target: &mut impl Write ) -> Result<(), Error>

Write text escaped for the given mode to target.
source§

fn write_raw(&self, target: &mut impl Write) -> Result<(), Error>

Write text as is to target.
source§

fn write_base64(&self, target: &mut impl Write) -> Result<(), Error>

Write text encoded in BASE64 to target.
source§

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

§

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§

default 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>,

§

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>,

§

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.
source§

impl<T> DeserializeOwned for T
where T: for<'de> Deserialize<'de>,