SnmpSharpNet.SnmpV3Packet.authNoPriv C# (CSharp) Метод

authNoPriv() публичный Метод

Set class security to enabled authentication and no privacy. To perform authentication, authentication password needs to be supplied and authentication protocol to be used to perform authentication. This method does not initialize the packet user name. Use SNMPV3Packet.SecurityName method to set the security name (also called user name) for this request.
public authNoPriv ( byte userName, byte authenticationPassword, AuthenticationDigests authenticationProtocol ) : void
userName byte User name
authenticationPassword byte Authentication password to use in authenticating the message. This /// value has to match the password configured on the agent.
authenticationProtocol AuthenticationDigests Authentication protocol to use. Available authentication protocols are: /// for HMAC-MD5 authentication, and /// for HMAC-SHA1 message authentication.
Результат void
        public void authNoPriv(byte[] userName, byte[] authenticationPassword, AuthenticationDigests authenticationProtocol)
        {
            NoAuthNoPriv(userName); // reset authentication and privacy values and set user name
            _msgFlags.Authentication = true;
            _userSecurityModel.Authentication = authenticationProtocol;
            _userSecurityModel.AuthenticationSecret.Set(authenticationPassword);
            _msgFlags.Privacy = false;
        }

Usage Example

        /// <summary>
        /// Construct and send SNMP v3 authNoPriv Trap
        /// </summary>
        /// <param name="receiver">Trap receiver IP address</param>
        /// <param name="receiverPort">Trap receiver UDP port number</param>
        /// <param name="engineId">Sender SNMP engineId</param>
        /// <param name="senderEngineBoots">Sender SNMP engine boots</param>
        /// <param name="senderEngineTime">Sender SNMP engine time</param>
        /// <param name="senderUserName">Security (user) name</param>
        /// <param name="senderUpTime">Sender upTime</param>
        /// <param name="trapObjectID">Trap object ID</param>
        /// <param name="varList">Variable binding list</param>
        /// <param name="authDigest">Authentication digest. <see cref="AuthenticationDigests"/> enumeration for
        /// available digests</param>
        /// <param name="authSecret">Authentication secret</param>
        public void SendV3Trap(IpAddress receiver, int receiverPort, byte[] engineId, Int32 senderEngineBoots,
                               Int32 senderEngineTime, string senderUserName, UInt32 senderUpTime, Oid trapObjectID, VbCollection varList,
                               AuthenticationDigests authDigest, byte[] authSecret)
        {
            SnmpV3Packet packet = new SnmpV3Packet();

            packet.Pdu.Type = PduType.V2Trap;
            packet.authNoPriv(ASCIIEncoding.UTF8.GetBytes(senderUserName), authSecret, authDigest);
            packet.SetEngineId(engineId);
            packet.SetEngineTime(senderEngineBoots, senderEngineTime);
            packet.ScopedPdu.TrapObjectID.Set(trapObjectID);
            packet.ScopedPdu.TrapSysUpTime.Value = senderUpTime;
            packet.ScopedPdu.VbList.Add(varList);
            packet.MsgFlags.Reportable = false;
            SendV3Trap(packet, receiver, receiverPort);
        }
All Usage Examples Of SnmpSharpNet.SnmpV3Packet::authNoPriv