SNMP++  3.3.4
AuthPriv Class Reference

Class that holds all authentication and privacy protocols for a snmp entity. More...

#include <auth_priv.h>

Collaboration diagram for AuthPriv:

Public Member Functions

 AuthPriv (int &construct_state)
 Default constructor, initializes random values. More...
 
 ~AuthPriv ()
 Destructor, deletes all auth and priv protocol objets. More...
 
int add_default_modules ()
 Add the default authentication protocols. More...
 
int add_auth (Auth *auth)
 Add a new authentication protocol. More...
 
int del_auth (const int auth_id)
 Delete a authentication protocol. More...
 
int add_priv (Priv *priv)
 Add a new privacy protocol. More...
 
int del_priv (const int priv_id)
 Delete a privacy protocol. More...
 
int password_to_key_auth (const int auth_prot, 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)
 Call the password-to-key method of the specified authentication protocol. More...
 
int password_to_key_priv (const int auth_prot, const int priv_prot, 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)
 Call the password-to-key method of the specified privacy protocol. More...
 
int get_keychange_value (const int auth_prot, const OctetStr &old_key, const OctetStr &new_key, OctetStr &keychange_value)
 Get the keyChange value for the specified keys using the given authentication protocol. More...
 
Privget_priv (const int priv_prot)
 Get a pointer to a privacy protocol object. More...
 
Authget_auth (const int auth_prot)
 Get a pointer to a authentication protocol object. More...
 
int get_auth_id (const char *string_id) const
 Get the unique id for the given auth protocol. More...
 
int get_priv_id (const char *string_id) const
 Get the unique id for the given priv protocol. More...
 
int encrypt_msg (const int priv_prot, const unsigned char *key, const unsigned int key_len, const unsigned char *buffer, const unsigned int buffer_len, unsigned char *out_buffer, unsigned int *out_buffer_len, unsigned char *privacy_params, unsigned int *privacy_params_len, const unsigned long engine_boots, const unsigned long engine_time)
 Encrypt a message. More...
 
int decrypt_msg (const int priv_prot, const unsigned char *key, const unsigned int key_len, const unsigned char *buffer, const unsigned int buffer_len, unsigned char *out_buffer, unsigned int *out_buffer_len, const unsigned char *privacy_params, const unsigned int privacy_params_len, const unsigned long engine_boots, const unsigned long engine_time)
 Decrypt a message. More...
 
int get_auth_params_len (const int auth_prot)
 Get the length of the authentication parameters field of the given authentication protocol. More...
 
int get_priv_params_len (const int priv_prot)
 Get the length of the privacy parameters field of the given privacy protocol. More...
 
int auth_out_msg (const int auth_prot, const unsigned char *key, unsigned char *msg, const int msg_len, unsigned char *auth_par_ptr)
 Fill in the authentication field of an outgoing message. More...
 
int auth_inc_msg (const int auth_prot, const unsigned char *key, unsigned char *msg, const int msg_len, unsigned char *auth_par_ptr, const int auth_par_len)
 Check the authentication field of an incoming message. More...
 

Private Attributes

AuthPtrauth
 Array of pointers to Auth-objects. More...
 
PrivPtrpriv
 Array of pointers to Priv-objects. More...
 
int auth_size
 current size of the auth array More...
 
int priv_size
 current size of the priv array More...
 
pp_uint64 salt
 current salt value (64 bits) More...
 

Detailed Description

Class that holds all authentication and privacy protocols for a snmp entity.

Definition at line 336 of file auth_priv.h.

Constructor & Destructor Documentation

AuthPriv::AuthPriv ( int &  construct_state)

Default constructor, initializes random values.

AuthPriv::~AuthPriv ( )

Destructor, deletes all auth and priv protocol objets.

Member Function Documentation

int AuthPriv::add_auth ( Auth auth)

Add a new authentication protocol.

All added objects will be deleted in the destructor

Parameters
auth- Pointer to a new auth protocol object
Returns
SNMP_CLASS_SUCCESS or SNMP_CLASS_ERROR
int AuthPriv::add_default_modules ( )

Add the default authentication protocols.

The following authentication protocols are added:

  • MD5
  • SHA

The following privacy protocols are added:

  • DES
  • AES128, AES192 and AES256 if libtomcrypt or OpenSSL is enabled
  • IDEA if enabled
Returns
SNMP_CLASS_SUCCESS or SNMP_CLASS_ERROR.
int AuthPriv::add_priv ( Priv priv)

Add a new privacy protocol.

All added objects will be deleted in the destructor

Parameters
priv- Pointer to a new privacy protocol object
Returns
SNMP_CLASS_SUCCESS or SNMP_CLASS_ERROR
int AuthPriv::auth_inc_msg ( const int  auth_prot,
const unsigned char *  key,
unsigned char *  msg,
const int  msg_len,
unsigned char *  auth_par_ptr,
const int  auth_par_len 
)

Check the authentication field of an incoming message.

int AuthPriv::auth_out_msg ( const int  auth_prot,
const unsigned char *  key,
unsigned char *  msg,
const int  msg_len,
unsigned char *  auth_par_ptr 
)

Fill in the authentication field of an outgoing message.

int AuthPriv::decrypt_msg ( const int  priv_prot,
const unsigned char *  key,
const unsigned int  key_len,
const unsigned char *  buffer,
const unsigned int  buffer_len,
unsigned char *  out_buffer,
unsigned int *  out_buffer_len,
const unsigned char *  privacy_params,
const unsigned int  privacy_params_len,
const unsigned long  engine_boots,
const unsigned long  engine_time 
)

Decrypt a message.

int AuthPriv::del_auth ( const int  auth_id)

Delete a authentication protocol.

Parameters
auth_id- The id of the authentication protocol to remove
Returns
SNMP_CLASS_SUCCESS or SNMP_CLASS_ERROR
int AuthPriv::del_priv ( const int  priv_id)

Delete a privacy protocol.

Parameters
priv_id- The id of the privacy protocol to remove
Returns
SNMP_CLASS_SUCCESS or SNMP_CLASS_ERROR
int AuthPriv::encrypt_msg ( const int  priv_prot,
const unsigned char *  key,
const unsigned int  key_len,
const unsigned char *  buffer,
const unsigned int  buffer_len,
unsigned char *  out_buffer,
unsigned int *  out_buffer_len,
unsigned char *  privacy_params,
unsigned int *  privacy_params_len,
const unsigned long  engine_boots,
const unsigned long  engine_time 
)

Encrypt a message.

Auth* AuthPriv::get_auth ( const int  auth_prot)

Get a pointer to a authentication protocol object.

int AuthPriv::get_auth_id ( const char *  string_id) const

Get the unique id for the given auth protocol.

Parameters
string_id- The string returned by Auth::get_id_string()
Returns
The id or -1
int AuthPriv::get_auth_params_len ( const int  auth_prot)

Get the length of the authentication parameters field of the given authentication protocol.

int AuthPriv::get_keychange_value ( const int  auth_prot,
const OctetStr old_key,
const OctetStr new_key,
OctetStr keychange_value 
)

Get the keyChange value for the specified keys using the given authentication protocol.

Priv* AuthPriv::get_priv ( const int  priv_prot)

Get a pointer to a privacy protocol object.

int AuthPriv::get_priv_id ( const char *  string_id) const

Get the unique id for the given priv protocol.

Parameters
string_id- The string returned by Priv::get_id_string()
Returns
The id or -1
int AuthPriv::get_priv_params_len ( const int  priv_prot)

Get the length of the privacy parameters field of the given privacy protocol.

int AuthPriv::password_to_key_auth ( const int  auth_prot,
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 
)

Call the password-to-key method of the specified authentication protocol.

int AuthPriv::password_to_key_priv ( const int  auth_prot,
const int  priv_prot,
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 
)

Call the password-to-key method of the specified privacy protocol.

Member Data Documentation

AuthPtr* AuthPriv::auth
private

Array of pointers to Auth-objects.

Definition at line 531 of file auth_priv.h.

int AuthPriv::auth_size
private

current size of the auth array

Definition at line 533 of file auth_priv.h.

PrivPtr* AuthPriv::priv
private

Array of pointers to Priv-objects.

Definition at line 532 of file auth_priv.h.

int AuthPriv::priv_size
private

current size of the priv array

Definition at line 534 of file auth_priv.h.

pp_uint64 AuthPriv::salt
private

current salt value (64 bits)

Definition at line 535 of file auth_priv.h.


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