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 |
§Interoperability with net-snmp
Some implementations (notably net-snmp) support AES-192/256 with shorter
authentication protocols using key extension. To interoperate with these
systems, use PrivKey::from_password_extended with
KeyExtension::Blumenthal.
§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
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more