Enum hickory_proto::rr::dnssec::rdata::tsig::TsigAlgorithm

source ·
pub enum TsigAlgorithm {
    HmacMd5,
    Gss,
    HmacSha1,
    HmacSha224,
    HmacSha256,
    HmacSha256_128,
    HmacSha384,
    HmacSha384_192,
    HmacSha512,
    HmacSha512_256,
    Unknown(Name),
}
Available on crate feature dnssec only.
Expand description

Algorithm used to authenticate communication

RFC8945 Secret Key Transaction Authentication for DNS

     +==========================+================+=================+
     | Algorithm Name           | Implementation | Use             |
     +==========================+================+=================+
     | HMAC-MD5.SIG-ALG.REG.INT | MAY            | MUST NOT        |
     +--------------------------+----------------+-----------------+
     | gss-tsig                 | MAY            | MAY             |
     +--------------------------+----------------+-----------------+
     | hmac-sha1                | MUST           | NOT RECOMMENDED |
     +--------------------------+----------------+-----------------+
     | hmac-sha224              | MAY            | MAY             |
     +--------------------------+----------------+-----------------+
     | hmac-sha256              | MUST           | RECOMMENDED     |
     +--------------------------+----------------+-----------------+
     | hmac-sha256-128          | MAY            | MAY             |
     +--------------------------+----------------+-----------------+
     | hmac-sha384              | MAY            | MAY             |
     +--------------------------+----------------+-----------------+
     | hmac-sha384-192          | MAY            | MAY             |
     +--------------------------+----------------+-----------------+
     | hmac-sha512              | MAY            | MAY             |
     +--------------------------+----------------+-----------------+
     | hmac-sha512-256          | MAY            | MAY             |
     +--------------------------+----------------+-----------------+

Variants§

§

HmacMd5

HMAC-MD5.SIG-ALG.REG.INT (not supported for cryptographic operations)

§

Gss

gss-tsig (not supported for cryptographic operations)

§

HmacSha1

hmac-sha1 (not supported for cryptographic operations)

§

HmacSha224

hmac-sha224 (not supported for cryptographic operations)

§

HmacSha256

hmac-sha256

§

HmacSha256_128

hmac-sha256-128 (not supported for cryptographic operations)

§

HmacSha384

hmac-sha384

§

HmacSha384_192

hmac-sha384-192 (not supported for cryptographic operations)

§

HmacSha512

hmac-sha512

§

HmacSha512_256

hmac-sha512-256 (not supported for cryptographic operations)

§

Unknown(Name)

Unkown algorithm

Implementations§

source§

impl TsigAlgorithm

source

pub fn to_name(&self) -> Name

Return DNS name for the algorithm

source

pub fn emit(&self, encoder: &mut BinEncoder<'_>) -> ProtoResult<()>

Write the Algorithm to the given encoder

source

pub fn read(decoder: &mut BinDecoder<'_>) -> ProtoResult<Self>

Read the Algorithm from the given Encoder

source

pub fn from_name(name: Name) -> Self

Convert a DNS name to an Algorithm

source

pub fn mac_data(&self, key: &[u8], message: &[u8]) -> ProtoResult<Vec<u8>>

Available on crate feature ring only.

Compute the Message Authentication Code using key and algorithm

Supported algorithm are HmacSha256, HmacSha384, HmacSha512 and HmacSha512_256 Other algorithm return an error.

source

pub fn verify_mac( &self, key: &[u8], message: &[u8], tag: &[u8] ) -> ProtoResult<()>

Available on crate feature ring only.

Verifies the hmac tag against the given key and this algorithm.

This is both faster than independently creating the MAC and also constant time preventing timing attacks

source

pub fn output_len(&self) -> ProtoResult<usize>

Available on crate feature ring only.

Return length in bytes of the algorithms output

source

pub fn supported(&self) -> bool

Return true if cryptographic operations needed for using this algorithm are supported, false otherwise

§Supported
  • HmacSha256
  • HmacSha384
  • HmacSha512
  • HmacSha512_256

Trait Implementations§

source§

impl Clone for TsigAlgorithm

source§

fn clone(&self) -> TsigAlgorithm

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 TsigAlgorithm

source§

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

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

impl<'de> Deserialize<'de> for TsigAlgorithm

source§

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 TsigAlgorithm

source§

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

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

impl Hash for TsigAlgorithm

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 TsigAlgorithm

source§

fn eq(&self, other: &TsigAlgorithm) -> 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 Serialize for TsigAlgorithm

source§

fn serialize<__S>(&self, __serializer: __S) -> Result<__S::Ok, __S::Error>
where __S: Serializer,

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

impl Eq for TsigAlgorithm

source§

impl StructuralPartialEq for TsigAlgorithm

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<Q, K> Equivalent<K> for Q
where Q: Eq + ?Sized, K: Borrow<Q> + ?Sized,

source§

fn equivalent(&self, key: &K) -> bool

Checks if this value is equivalent to the given key. Read more
source§

impl<Q, K> Equivalent<K> for Q
where Q: Eq + ?Sized, K: Borrow<Q> + ?Sized,

source§

fn equivalent(&self, key: &K) -> bool

Compare self to key and return true if they are equal.
source§

impl<T> From<T> for T

source§

fn from(t: T) -> T

Returns the argument unchanged.

source§

impl<T> Instrument for T

source§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
source§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
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> 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<V, T> VZip<V> for T
where V: MultiLane<T>,

source§

fn vzip(self) -> V

source§

impl<T> WithSubscriber for T

source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
source§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more
source§

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