pub trait KeyStore {
    type Key: AsRef<Key>;

    fn get_key<N: ToDname>(
        &self,
        name: &N,
        algorithm: Algorithm
    ) -> Option<Self::Key>; }
Available on crate feature tsig only.
Expand description

A type that stores TSIG secret keys.

This trait is used by ServerTransaction and ServerSequence to determine whether a key of a TSIG signed message is known to this server.

In order to allow sharing of keys, the trait allows the implementing type to pick its representation via the Key associated type. The get_key method tries to return a key for a given pair of name and algorithm.

Implementations are provided for a HashMap mapping those pairs of name and algorithm to an as-ref of a key (such as an arc) as well as for as-refs of a single key. The latter is useful if you know the key to use already.

If you need to limit the keys available based on properties of the received message, you may need to implement your key store type that wraps a more general store and limits its available keys.

Required Associated Types

The representation of the key returned by the store.

Required Methods

Tries to find a key in the store.

The method looks up a key based on a pair of name and algorithm. If the key can be found, it is returned. Otherwise, None is returned.

Implementations on Foreign Types

Implementors