[SNMP4J] Unit Test SNMP v3 Agent with TestSnmpManager
ulrich berl
ulrich.berl at gmx.net
Tue Aug 7 08:28:20 CEST 2018
Hi Frank!
For the TestSnmpManager i tried the Key Localization as described in https://oosnmp.net/confluence/pages/viewpage.action?pageId=1441800.
But same result as before: using a wrong auth password results in a successful snmp request.
This is the block from get request in the TestSnmpManager:
SecurityProtocols secProtocols = SecurityProtocols.getInstance();
Target t = getTarget();
byte[] engineID = snmp.discoverAuthoritativeEngineID(t.getAddress(), t.getTimeout());
OctetString authKey = new OctetString(authPassphrase);
byte[] bytesAuthKey = secProtocols.passwordToKey(authProtocol, authKey, engineID);
OctetString privKey = new OctetString(privPassphrase);
byte[] bytesPrivKey = secProtocols.passwordToKey(privProtocol, authProtocol, privKey, engineID);
snmp.getUSM().addLocalizedUser(engineID, securityName,
authProtocol, bytesAuthKey,
privProtocol, bytesPrivKey);
Maybe I'll do something wrong ...
br, Ulrich
More information about the SNMP4J
mailing list