Struct hickory_proto::rr::dnssec::tsig::TSigner

source ·
pub struct TSigner(/* private fields */);
Available on crate feature dnssec only.
Expand description

Struct to pass to a client for it to authenticate requests using TSIG.

Implementations§

source§

impl TSigner

source

pub fn new( key: Vec<u8>, algorithm: TsigAlgorithm, signer_name: Name, fudge: u16 ) -> ProtoResult<Self>

Create a new Tsigner from its parts

§Arguments
  • key - cryptographic key used to authenticate exchanges
  • algorithm - algorithm used to authenticate exchanges
  • signer_name - name of the key. Must match the name known to the server
  • fudge - maximum difference between client and server time, in seconds, see fudge for details
source

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

Return the key used for message authentication

source

pub fn algorithm(&self) -> &TsigAlgorithm

Return the algorithm used for message authentication

source

pub fn signer_name(&self) -> &Name

Name of the key used by this signer

source

pub fn fudge(&self) -> u16

Maximum time difference between client time when issuing a message, and server time when receiving it, in second. If time is out, the server will consider the request invalid. Longer values means more room for replay by an attacker. A few minutes are usually a good value.

source

pub fn sign(&self, tbs: &[u8]) -> ProtoResult<Vec<u8>>

Compute authentication tag for a buffer

source

pub fn sign_message( &self, message: &Message, pre_tsig: &TSIG ) -> ProtoResult<Vec<u8>>

Compute authentication tag for a message

source

pub fn verify(&self, tbv: &[u8], tag: &[u8]) -> ProtoResult<()>

Verify hmac in constant time to prevent timing attacks

source

pub fn verify_message_byte( &self, previous_hash: Option<&[u8]>, message: &[u8], first_message: bool ) -> ProtoResult<(Vec<u8>, Range<u64>, u64)>

Verify the message is correctly signed This does not perform time verification on its own, instead one should verify current time lie in returned Range

§Arguments
  • previous_hash - Hash of the last message received before this one, or of the query for the first message
  • message - byte buffer containing current message
  • first_message - is this the first response message
§Returns

Return Ok(_) on valid signature. Inner tuple contain the following values, in order:

  • a byte buffer containing the hash of this message. Need to be passed back when authenticating next message
  • a Range of time that is acceptable
  • the time the signature was emitted. It must be greater or equal to the time of previous messages, if any

Trait Implementations§

source§

impl Clone for TSigner

source§

fn clone(&self) -> TSigner

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 MessageFinalizer for TSigner

source§

fn finalize_message( &self, message: &Message, current_time: u32 ) -> ProtoResult<(Vec<Record>, Option<MessageVerifier>)>

The message taken in should be processed and then return Records which should be appended to the additional section of the message. Read more
source§

fn should_finalize_message(&self, message: &Message) -> bool

Return whether the message requires further processing before being sent By default, returns true for AXFR and IXFR queries, and Update and Notify messages

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