C# Class SnmpSharpNet.AuthenticationSHA1

SHA-1 Authentication class.
Inheritance: IAuthenticationDigest
显示文件 Open project: griffina/SnmpSharpNet

Public Methods

Method Description
AuthenticationSHA1 ( ) : System

Standard constructor.

ComputeHash ( byte data, int offset, int count ) : byte[]

Compute hash using authentication protocol.

PasswordToKey ( byte userPassword, byte engineID ) : byte[]

Convert user password to acceptable authentication key.

authenticate ( byte authKey, byte wholeMessage ) : byte[]

Authenticate packet and return authentication parameters value to the caller

authenticate ( byte authenticationSecret, byte engineId, byte wholeMessage ) : byte[]

Authenticate packet and return authentication parameters value to the caller

authenticateIncomingMsg ( byte authKey, byte authenticationParameters, MutableByte wholeMessage ) : bool

Verify SHA-1 authentication of a packet.

authenticateIncomingMsg ( byte userPassword, byte engineId, byte authenticationParameters, MutableByte wholeMessage ) : bool

Verifies correct SHA-1 authentication of the frame. Prior to calling this method, you have to extract authentication parameters from the wholeMessage and reset authenticationParameters field in the USM information block to 12 0x00 values.

Method Details

AuthenticationSHA1() public method

Standard constructor.
public AuthenticationSHA1 ( ) : System
return System

ComputeHash() public method

Compute hash using authentication protocol.
public ComputeHash ( byte data, int offset, int count ) : byte[]
data byte Data to hash
offset int Compute hash from the source buffer offset
count int Compute hash for source data length
return byte[]

PasswordToKey() public method

Convert user password to acceptable authentication key.
Thrown when key length is less then 8 bytes
public PasswordToKey ( byte userPassword, byte engineID ) : byte[]
userPassword byte User password
engineID byte Authoritative engine id
return byte[]

authenticate() public method

Authenticate packet and return authentication parameters value to the caller
public authenticate ( byte authKey, byte wholeMessage ) : byte[]
authKey byte Authentication key (not password)
wholeMessage byte Message to authenticate
return byte[]

authenticate() public method

Authenticate packet and return authentication parameters value to the caller
public authenticate ( byte authenticationSecret, byte engineId, byte wholeMessage ) : byte[]
authenticationSecret byte User authentication secret
engineId byte SNMP agent authoritative engine id
wholeMessage byte Message to authenticate
return byte[]

authenticateIncomingMsg() public method

Verify SHA-1 authentication of a packet.
public authenticateIncomingMsg ( byte authKey, byte authenticationParameters, MutableByte wholeMessage ) : bool
authKey byte Authentication key (not password)
authenticationParameters byte Authentication parameters extracted from the packet being authenticated
wholeMessage MutableByte Entire packet being authenticated
return bool

authenticateIncomingMsg() public method

Verifies correct SHA-1 authentication of the frame. Prior to calling this method, you have to extract authentication parameters from the wholeMessage and reset authenticationParameters field in the USM information block to 12 0x00 values.
public authenticateIncomingMsg ( byte userPassword, byte engineId, byte authenticationParameters, MutableByte wholeMessage ) : bool
userPassword byte User password
engineId byte Authoritative engine id
authenticationParameters byte Extracted USM authentication parameters
wholeMessage MutableByte Whole message with authentication parameters zeroed (0x00) out
return bool