Sergey Pastor / 1

Dependents:   Nucleo

Embed: (wiki syntax)

« Back to documentation index

snmp_usm.h File Reference

snmp_usm.h File Reference

User-based Security Model (USM) for SNMPv3. More...

Go to the source code of this file.

Data Structures

struct  SnmpKey
 SNMP secret key. More...
struct  SnmpUserInfo
 SNMP user information. More...

Enumerations

enum  SnmpMessageFlags
 

SNMP message flags.

More...
enum  SnmpSecurityModel { SNMP_SECURITY_MODEL_USM = 3, SNMP_SECURITY_MODEL_TSM = 4 }
 

SNMP security models.

More...
enum  SnmpAccess
 

Access modes.

More...
enum  SnmpAuthProtocol {
  SNMP_AUTH_PROTOCOL_NONE = 0, SNMP_AUTH_PROTOCOL_MD5 = 1, SNMP_AUTH_PROTOCOL_SHA1 = 2, SNMP_AUTH_PROTOCOL_SHA224 = 3,
  SNMP_AUTH_PROTOCOL_SHA256 = 4, SNMP_AUTH_PROTOCOL_SHA384 = 5, SNMP_AUTH_PROTOCOL_SHA512 = 6
}
 

SNMP authentication protocols.

More...
enum  SnmpPrivProtocol { SNMP_PRIV_PROTOCOL_NONE = 0, SNMP_PRIV_PROTOCOL_DES = 1, SNMP_PRIV_PROTOCOL_AES = 2 }
 

SNMP privacy protocols.

More...
enum  SnmpKeyFormat { SNMP_KEY_FORMAT_NONE = 0, SNMP_KEY_FORMAT_TEXT = 1, SNMP_KEY_FORMAT_RAW = 2 }
 

SNMP key format.

More...

Functions

error_t snmpGenerateKey (SnmpAuthProtocol authProtocol, const char_t *password, const uint8_t *engineId, size_t engineIdLen, SnmpKey *key)
 Password to key algorithm.
error_t snmpCheckSecurityParameters (const SnmpUserInfo *user, SnmpMessage *message, const uint8_t *engineId, size_t engineIdLen)
 Check security parameters.
error_t snmpAuthOutgoingMessage (const SnmpUserInfo *user, SnmpMessage *message)
 Authenticate outgoing SNMP message.
error_t snmpAuthIncomingMessage (const SnmpUserInfo *user, SnmpMessage *message)
 Authenticate incoming SNMP message.
error_t snmpEncryptData (const SnmpUserInfo *user, SnmpMessage *message, uint64_t *salt)
 Data encryption.
error_t snmpDecryptData (const SnmpUserInfo *user, SnmpMessage *message)
 Data decryption.

Detailed Description

User-based Security Model (USM) for SNMPv3.

License

Copyright (C) 2010-2017 Oryx Embedded SARL. All rights reserved.

This file is part of CycloneTCP Open.

This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version.

This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.

You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.

Author:
Oryx Embedded SARL (www.oryx-embedded.com)
Version:
1.7.6

Definition in file snmp_usm.h.


Enumeration Type Documentation

enum SnmpAccess

Access modes.

Definition at line 207 of file snmp_usm.h.

SNMP authentication protocols.

Enumerator:
SNMP_AUTH_PROTOCOL_NONE 

No authentication.

SNMP_AUTH_PROTOCOL_MD5 

HMAC-MD5-96.

SNMP_AUTH_PROTOCOL_SHA1 

HMAC-SHA-1-96.

SNMP_AUTH_PROTOCOL_SHA224 

HMAC-SHA-224-128.

SNMP_AUTH_PROTOCOL_SHA256 

HMAC-SHA-256-192.

SNMP_AUTH_PROTOCOL_SHA384 

HMAC-SHA-384-256.

SNMP_AUTH_PROTOCOL_SHA512 

HMAC-SHA-512-384.

Definition at line 220 of file snmp_usm.h.

SNMP key format.

Enumerator:
SNMP_KEY_FORMAT_NONE 

Unspecified key format.

SNMP_KEY_FORMAT_TEXT 

ASCII password.

SNMP_KEY_FORMAT_RAW 

Raw key.

Definition at line 248 of file snmp_usm.h.

SNMP message flags.

Definition at line 184 of file snmp_usm.h.

SNMP privacy protocols.

Enumerator:
SNMP_PRIV_PROTOCOL_NONE 

No privacy.

SNMP_PRIV_PROTOCOL_DES 

DES-CBC.

SNMP_PRIV_PROTOCOL_AES 

AES-128-CFB.

Definition at line 236 of file snmp_usm.h.

SNMP security models.

Enumerator:
SNMP_SECURITY_MODEL_USM 

User-based security model.

SNMP_SECURITY_MODEL_TSM 

Transport security model.

Definition at line 196 of file snmp_usm.h.


Function Documentation

error_t snmpAuthIncomingMessage ( const SnmpUserInfo user,
SnmpMessage message 
)

Authenticate incoming SNMP message.

Parameters:
[in]userSecurity profile of the user
[in]messagePointer to the incoming SNMP message
Returns:
Error code

Definition at line 339 of file snmp_usm.c.

error_t snmpAuthOutgoingMessage ( const SnmpUserInfo user,
SnmpMessage message 
)

Authenticate outgoing SNMP message.

Parameters:
[in]userSecurity profile of the user
[in,out]messagePointer to the outgoing SNMP message
Returns:
Error code

Definition at line 237 of file snmp_usm.c.

error_t snmpCheckSecurityParameters ( const SnmpUserInfo user,
SnmpMessage message,
const uint8_t *  engineId,
size_t  engineIdLen 
)

Check security parameters.

Parameters:
[in]userSecurity profile of the user
[in,out]messagePointer to the incoming SNMP message
[in]engineIdPointer to the authoritative engine ID
[in]engineIdLenLength of the authoritative engine ID
Returns:
Error code

Definition at line 190 of file snmp_usm.c.

error_t snmpDecryptData ( const SnmpUserInfo user,
SnmpMessage message 
)

Data decryption.

Parameters:
[in]userSecurity profile of the user
[in,out]messagePointer to the incoming SNMP message
Returns:
Error code

Definition at line 594 of file snmp_usm.c.

error_t snmpEncryptData ( const SnmpUserInfo user,
SnmpMessage message,
uint64_t *  salt 
)

Data encryption.

Parameters:
[in]userSecurity profile of the user
[in,out]messagePointer to the outgoing SNMP message
[in,out]saltPointer to the salt integer
Returns:
Error code

Definition at line 455 of file snmp_usm.c.

error_t snmpGenerateKey ( SnmpAuthProtocol  authProtocol,
const char_t *  password,
const uint8_t *  engineId,
size_t  engineIdLen,
SnmpKey key 
)

Password to key algorithm.

Parameters:
[in]authProtocolAuthentication protocol (MD5 or SHA-1)
[in]passwordNULL-terminated string that contains the password
[in]engineIdPointer to the engine ID
[in]engineIdLenLength of the engine ID
[out]keyPointer to the resulting key
Returns:
Error code

Definition at line 77 of file snmp_usm.c.