Enum trust_dns_client::rr::rdata::tsig::TsigAlgorithm
source · [−]pub enum TsigAlgorithm {
HmacMd5,
Gss,
HmacSha1,
HmacSha224,
HmacSha256,
HmacSha256_128,
HmacSha384,
HmacSha384_192,
HmacSha512,
HmacSha512_256,
Unknown(Name),
}
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
sourceimpl TsigAlgorithm
impl TsigAlgorithm
sourcepub fn emit(&self, encoder: &mut BinEncoder<'_>) -> Result<(), ProtoError>
pub fn emit(&self, encoder: &mut BinEncoder<'_>) -> Result<(), ProtoError>
Write the Algorithm to the given encoder
sourcepub fn read(decoder: &mut BinDecoder<'_>) -> Result<TsigAlgorithm, ProtoError>
pub fn read(decoder: &mut BinDecoder<'_>) -> Result<TsigAlgorithm, ProtoError>
Read the Algorithm from the given Encoder
sourcepub fn from_name(name: Name) -> TsigAlgorithm
pub fn from_name(name: Name) -> TsigAlgorithm
Convert a DNS name to an Algorithm
sourcepub fn mac_data(
&self,
key: &[u8],
message: &[u8]
) -> Result<Vec<u8, Global>, ProtoError>
pub fn mac_data(
&self,
key: &[u8],
message: &[u8]
) -> Result<Vec<u8, Global>, ProtoError>
Compute the Message Authentication Code using key and algorithm
Supported algorithm are HmacSha256, HmacSha384, HmacSha512 and HmacSha512_256 Other algorithm return an error.
sourcepub fn verify_mac(
&self,
key: &[u8],
message: &[u8],
tag: &[u8]
) -> Result<(), ProtoError>
pub fn verify_mac(
&self,
key: &[u8],
message: &[u8],
tag: &[u8]
) -> Result<(), ProtoError>
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
sourcepub fn output_len(&self) -> Result<usize, ProtoError>
pub fn output_len(&self) -> Result<usize, ProtoError>
Return length in bytes of the algorithms output
Trait Implementations
sourceimpl Clone for TsigAlgorithm
impl Clone for TsigAlgorithm
sourcepub fn clone(&self) -> TsigAlgorithm
pub fn clone(&self) -> TsigAlgorithm
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 Debug for TsigAlgorithm
impl Debug for TsigAlgorithm
sourceimpl Display for TsigAlgorithm
impl Display for TsigAlgorithm
sourceimpl Hash for TsigAlgorithm
impl Hash for TsigAlgorithm
sourceimpl PartialEq<TsigAlgorithm> for TsigAlgorithm
impl PartialEq<TsigAlgorithm> for TsigAlgorithm
sourcepub fn eq(&self, other: &TsigAlgorithm) -> bool
pub fn eq(&self, other: &TsigAlgorithm) -> bool
This method tests for self
and other
values to be equal, and is used
by ==
. Read more
sourcepub fn ne(&self, other: &TsigAlgorithm) -> bool
pub fn ne(&self, other: &TsigAlgorithm) -> bool
This method tests for !=
.
impl Eq for TsigAlgorithm
impl StructuralEq for TsigAlgorithm
impl StructuralPartialEq for TsigAlgorithm
Auto Trait Implementations
impl RefUnwindSafe for TsigAlgorithm
impl Send for TsigAlgorithm
impl Sync for TsigAlgorithm
impl Unpin for TsigAlgorithm
impl UnwindSafe for TsigAlgorithm
Blanket Implementations
sourceimpl<T> BorrowMut<T> for T where
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
const: unstable · sourcepub fn borrow_mut(&mut self) -> &mut T
pub fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
sourceimpl<Q, K> Equivalent<K> for Q where
Q: Eq + ?Sized,
K: Borrow<Q> + ?Sized,
impl<Q, K> Equivalent<K> for Q where
Q: Eq + ?Sized,
K: Borrow<Q> + ?Sized,
sourcepub fn equivalent(&self, key: &K) -> bool
pub fn equivalent(&self, key: &K) -> bool
Compare self to key
and return true
if they are equal.
sourceimpl<T> Instrument for T
impl<T> Instrument for T
sourcefn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
sourcefn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
sourceimpl<T> ToOwned for T where
T: Clone,
impl<T> ToOwned for T where
T: Clone,
type Owned = T
type Owned = T
The resulting type after obtaining ownership.
sourcepub fn to_owned(&self) -> T
pub fn to_owned(&self) -> T
Creates owned data from borrowed data, usually by cloning. Read more
sourcepub fn clone_into(&self, target: &mut T)
pub fn clone_into(&self, target: &mut T)
toowned_clone_into
)Uses borrowed data to replace owned data, usually by cloning. Read more
impl<V, T> VZip<V> for T where
V: MultiLane<T>,
impl<V, T> VZip<V> for T where
V: MultiLane<T>,
pub fn vzip(self) -> V
sourceimpl<T> WithSubscriber for T
impl<T> WithSubscriber for T
sourcefn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self> where
S: Into<Dispatch>,
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
sourcefn with_current_subscriber(self) -> WithDispatch<Self>
fn with_current_subscriber(self) -> WithDispatch<Self>
Attaches the current default Subscriber
to this type, returning a
WithDispatch
wrapper. Read more