"Look-ahead" decode of SNMP packet header including USM information

Namespace:  SnmpSharpNet
Assembly:  SnmpSharpNet (in SnmpSharpNet.dll) Version: 0.7.0.0 (0.7.0.0)

Syntax

C#
public UserSecurityModel GetUSM(
	byte[] berBuffer,
	int length
)
Visual Basic (Declaration)
Public Function GetUSM ( _
	berBuffer As Byte(), _
	length As Integer _
) As UserSecurityModel
Visual C++
public:
UserSecurityModel^ GetUSM(
	array<unsigned char>^ berBuffer, 
	int length
)

Parameters

berBuffer
Type: array< System..::.Byte >[]()[]
Raw SNMP version 3 packet
length
Type: System..::.Int32
SNMP version 3 packet length

Return Value

UserSecurityModel class parsed from the parameter SNMP version 3 packet

Remarks

Decode first component of the SNMP version 3 packet allowing the caller to retrieve USM SecureName needed to retrieve client security parameters that will allow authentication and privacy decryption to take place. This method is used to support Agent like behavior or to handle unsolicited packets like TRAP and INFORMs. In all of these cases, sender of packets will forward a packet without a request being sent by you. In turn, you will need to parse enough of the packet to retrieve SecureName which you can use to retrieve security parameters associated with that user and attempt to authorize and privacy decrypt the received packet. Only use this method when your application is acting as an Agent or if you need to process TRAP and INFORM packets.

See Also