Main Page | Class Hierarchy | Alphabetical List | Compound List | File List | Compound Members | File Members

AuthMD5 Class Reference

#include <auth_priv.h>

Inheritance diagram for AuthMD5:

[legend]
Collaboration diagram for AuthMD5:
[legend]
List of all members.

Detailed Description

Authentication module using MD5.

See also:
Auth

Definition at line 566 of file auth_priv.h.

Public Member Functions

int password_to_key (const unsigned char *password, const unsigned int password_len, const unsigned char *engine_id, const unsigned int engine_id_len, unsigned char *key, unsigned int *key_len)
 Generate the localized key for the given password and engine id.

int hash (const unsigned char *data, const unsigned int data_len, unsigned char *digest)
 Generate a hash value for the given data.

int auth_out_msg (const unsigned char *key, unsigned char *msg, const int msg_len, unsigned char *auth_par_ptr)
 Authenticate an outgoing message.

int auth_inc_msg (const unsigned char *key, unsigned char *msg, const int msg_len, unsigned char *auth_par_ptr, const int auth_par_len)
 Authenticate an incoming message.

int get_id () const
 Get the unique id of the authentication protocol.

const char * get_id_string () const
 Get the unique identifier string of the authentication protocol.

int get_auth_params_len () const
 Get the maximum length that is needed for the msgAuthenticationParameters field.

int get_hash_len () const
 Get length of a hash output.


Member Function Documentation

int AuthMD5::auth_inc_msg const unsigned char *  key,
unsigned char *  msg,
const int  msg_len,
unsigned char *  auth_par_ptr,
const int  auth_par_len
[virtual]
 

Authenticate an incoming message.

This method checks if the value in the authentication parameters field of the message is valid.

The following procedure is used to verify the authenitcation value

  • copy the authentication value to a temp buffer
  • zero the auth field
  • recalculate the authenthication value
  • compare the two authentcation values
  • write back the received authentication value if values differ

Parameters:
key - pointer to the (fixed length) key
msg - pointer to the whole message
msg_len - the length of the message
auth_par_ptr - pointer to the auth field inside the msg buffer
auth_par_len - Length of the received auth field
Returns:
SNMPv3_USM_OK if the msg is valid, SNMPv3_USM_AUTHENTICATION_FAILURE if not and SNMPv3_USM_ERROR for unexpected errors.

Implements Auth.

int AuthMD5::auth_out_msg const unsigned char *  key,
unsigned char *  msg,
const int  msg_len,
unsigned char *  auth_par_ptr
[virtual]
 

Authenticate an outgoing message.

This method fills the authentication parameters field of the given message. The param auth_par_ptr is pointing inside the message buffer and must be zeroed before the authentication value is computed.

Parameters:
key - pointer to the (fixed length) key
msg - pointer to the whole message
msg_len - the length of the message
auth_par_ptr - pointer to the auth field inside the msg buffer
Returns:
SNMPv3_USM_OK on success and SNMPv3_USM_ERROR for unexpected errors.

Implements Auth.

int AuthMD5::get_auth_params_len  )  const [inline, virtual]
 

Get the maximum length that is needed for the msgAuthenticationParameters field.

Implements Auth.

Definition at line 596 of file auth_priv.h.

int AuthMD5::get_hash_len  )  const [inline, virtual]
 

Get length of a hash output.

Implements Auth.

Definition at line 598 of file auth_priv.h.

References SNMPv3_AP_OUTPUT_LENGTH_MD5.

int AuthMD5::get_id  )  const [inline, virtual]
 

Get the unique id of the authentication protocol.

Implements Auth.

Definition at line 592 of file auth_priv.h.

References SNMP_AUTHPROTOCOL_HMACMD5.

const char* AuthMD5::get_id_string  )  const [inline, virtual]
 

Get the unique identifier string of the authentication protocol.

Implements Auth.

Definition at line 594 of file auth_priv.h.

int AuthMD5::hash const unsigned char *  data,
const unsigned int  data_len,
unsigned char *  digest
[virtual]
 

Generate a hash value for the given data.

Parameters:
data - the data
data_len - the length of the data
digest - pointer to the generated digest
Returns:
SNMPv3_USM_OK on success

Implements Auth.

int AuthMD5::password_to_key const unsigned char *  password,
const unsigned int  password_len,
const unsigned char *  engine_id,
const unsigned int  engine_id_len,
unsigned char *  key,
unsigned int *  key_len
[virtual]
 

Generate the localized key for the given password and engine id.

Parameters:
password - the password
password_len - the length of the password
engine_id - pointer to snmpEngineID
engine_id_len - length of snmpEngineID
key - pointer to an empty buffer that will be filled with generated key
key_len - IN: length of the buffer OUT: length of the key
Returns:
SNMPv3_USM_OK on success

Implements Auth.


The documentation for this class was generated from the following file:
Generated on Tue Jan 4 22:42:15 2005 for SNMP++ by doxygen 1.3.2