pub enum AuthProtocol {
Md5,
Sha1,
Sha224,
Sha256,
Sha384,
Sha512,
}Expand description
Authentication protocol identifiers.
Variants§
Md5
HMAC-MD5-96 (RFC 3414)
Sha1
HMAC-SHA-96 (RFC 3414)
Sha224
HMAC-SHA-224 (RFC 7860)
Sha256
HMAC-SHA-256 (RFC 7860)
Sha384
HMAC-SHA-384 (RFC 7860)
Sha512
HMAC-SHA-512 (RFC 7860)
Implementations§
Source§impl AuthProtocol
impl AuthProtocol
Sourcepub fn digest_len(self) -> usize
pub fn digest_len(self) -> usize
Get the digest output length in bytes.
This is also the key length produced by the key localization algorithm, which is used for privacy key derivation.
Sourcepub fn is_compatible_with(self, priv_protocol: PrivProtocol) -> bool
pub fn is_compatible_with(self, priv_protocol: PrivProtocol) -> bool
Check if this authentication protocol produces sufficient key material for the given privacy protocol.
Privacy keys are derived from the localized authentication key, so the auth protocol must produce at least as many bytes as the privacy protocol requires:
| Privacy Protocol | Required Key Length | Compatible Auth Protocols |
|---|---|---|
| DES | 16 bytes | All (MD5+) |
| AES-128 | 16 bytes | All (MD5+) |
| AES-192 | 24 bytes | SHA-224, SHA-256, SHA-384, SHA-512 |
| AES-256 | 32 bytes | SHA-256, SHA-384, SHA-512 |
§Example
use async_snmp::{AuthProtocol, PrivProtocol};
// SHA-256 works with all privacy protocols
assert!(AuthProtocol::Sha256.is_compatible_with(PrivProtocol::Aes256));
// SHA-1 doesn't produce enough key material for AES-256
assert!(!AuthProtocol::Sha1.is_compatible_with(PrivProtocol::Aes256));Trait Implementations§
Source§impl Clone for AuthProtocol
impl Clone for AuthProtocol
Source§fn clone(&self) -> AuthProtocol
fn clone(&self) -> AuthProtocol
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Debug for AuthProtocol
impl Debug for AuthProtocol
Source§impl<'de> Deserialize<'de> for AuthProtocol
impl<'de> Deserialize<'de> for AuthProtocol
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
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 AuthProtocol
impl Display for AuthProtocol
Source§impl FromStr for AuthProtocol
impl FromStr for AuthProtocol
Source§impl PartialEq for AuthProtocol
impl PartialEq for AuthProtocol
Source§impl Serialize for AuthProtocol
impl Serialize for AuthProtocol
impl Copy for AuthProtocol
impl Eq for AuthProtocol
impl StructuralPartialEq for AuthProtocol
Auto Trait Implementations§
impl Freeze for AuthProtocol
impl RefUnwindSafe for AuthProtocol
impl Send for AuthProtocol
impl Sync for AuthProtocol
impl Unpin for AuthProtocol
impl UnwindSafe for AuthProtocol
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more