SNMP Reference Manual
SNMP configuration within the SNMPv3 administration framework Page 8 of 37
RFC1321, takes “as input a message of arbitrary length and produces as output a fingerprint or ‘message
digest’ of the input.”
HMAC, defined in RFC2104,
• computes an MD5 hash (H)on the concatenation of
(a) the shared secret key (K), which has been XORed with the hexadecimal value ‘36 ’(ipad),
and
(b) the SNMP message (text), which contains zero bytes in the digest field, to produce an
intermediate digest, and
• computes an MD5 hash on the concatenation of
(a) the shared secret key, which has been XORed with the hexadecimal value ‘5C ’(opad),
and
(b) the intermediate digest to produce the final digest.
The HMAC function is summarized by the following expression:
FIGURE 3- HMAC EXPRESSION
HMAC is used in the following manner to protect against threats to management operations:
• The sender and intended recipient of the SNMPv3 message share a secret key.
• When the sender constructs the outgoing message, the sender’s notion of the SNMP agent ’s time is
inserted into the message, and the digest field is padded with zeros. The HMAC function is then used
to compute a digest (“fingerprint”) over the concatenation of the sender ’s notion of the shared
secret key and SNMPv3 message.
• The digest is then inserted into the message at the position where the padding previously had been.
• The message is then sent.
• When the recipient receives the message, the digest in the incoming message is saved.
• The recipient inserts zeros into the incoming message at the position where the shared secret key
previously had been.
• In the same manner as the sender, the recipient uses HMAC to compute a digest of the incoming
message (with padding instead of a digest) and the recipient ’s notion of the shared secret key.
The recipient then compares:
• the digest computed over the incoming message,
• the digest that was saved from the incoming message.
If the shared secret key has not been compromised2, and if the two digests above exactly match, then
there is a high degree of confidence3that the following statements about the message are true:
2SNMPv3 cannot protect against the threat of compromised keys. If an unauthorized user knows a shared secret key, then that user can masquerade as another user, modify
messages in transit, and modify the message stream.