SNMP++  3.3.4
Auth Class Referenceabstract

Abstract class for auth modules. More...

#include <auth_priv.h>

Inheritance diagram for Auth:

Public Member Functions

virtual ~Auth ()
 
virtual 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)=0
 Generate the localized key for the given password and engine id. More...
 
virtual int hash (const unsigned char *data, const unsigned int data_len, unsigned char *digest) const =0
 Generate a hash value for the given data. More...
 
virtual int auth_out_msg (const unsigned char *key, unsigned char *msg, const int msg_len, unsigned char *auth_par_ptr)=0
 Authenticate an outgoing message. More...
 
virtual 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)=0
 Authenticate an incoming message. More...
 
virtual int get_id () const =0
 Get the unique id of the authentication protocol. More...
 
virtual const char * get_id_string () const =0
 Get the unique identifier string of the authentication protocol. More...
 
virtual void set_salt (pp_uint64 *new_salt)
 Set the pointer to the salt that should be used. More...
 
virtual int get_auth_params_len () const =0
 Get the maximum length that is needed for the msgAuthenticationParameters field. More...
 
virtual int get_hash_len () const =0
 Get length of a hash output. More...
 

Protected Attributes

pp_uint64salt
 

Detailed Description

Abstract class for auth modules.

This class has to be subclassed to add new authentication protocols.

Definition at line 61 of file auth_priv.h.

Constructor & Destructor Documentation

virtual Auth::~Auth ( )
inlinevirtual

Definition at line 65 of file auth_priv.h.

Member Function Documentation

virtual int Auth::auth_inc_msg ( const unsigned char *  key,
unsigned char *  msg,
const int  msg_len,
unsigned char *  auth_par_ptr,
const int  auth_par_len 
)
pure 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.

Implemented in AuthMD5, and AuthSHA.

virtual int Auth::auth_out_msg ( const unsigned char *  key,
unsigned char *  msg,
const int  msg_len,
unsigned char *  auth_par_ptr 
)
pure 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.

Implemented in AuthMD5, and AuthSHA.

virtual int Auth::get_auth_params_len ( ) const
pure virtual

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

Implemented in AuthMD5, and AuthSHA.

virtual int Auth::get_hash_len ( ) const
pure virtual

Get length of a hash output.

Implemented in AuthMD5, and AuthSHA.

virtual int Auth::get_id ( ) const
pure virtual

Get the unique id of the authentication protocol.

Implemented in AuthMD5, and AuthSHA.

virtual const char* Auth::get_id_string ( ) const
pure virtual

Get the unique identifier string of the authentication protocol.

Implemented in AuthMD5, and AuthSHA.

virtual int Auth::hash ( const unsigned char *  data,
const unsigned int  data_len,
unsigned char *  digest 
) const
pure 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

Implemented in AuthMD5, and AuthSHA.

virtual int Auth::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 
)
pure 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

Implemented in AuthMD5, and AuthSHA.

virtual void Auth::set_salt ( pp_uint64 new_salt)
inlinevirtual

Set the pointer to the salt that should be used.

Definition at line 166 of file auth_priv.h.

Member Data Documentation

pp_uint64* Auth::salt
protected

Definition at line 180 of file auth_priv.h.


The documentation for this class was generated from the following file: