Start agent with our own security data

The contextName in the above call must n to be null. To map to the default context use: new OctetString() instead.

The mask value in the above call must not be null (a null value will cause a NullPointerException during request processing and will not authorise the request).

Frank

Got it. I will try again with some value. Is there an example on how to properly add our own security?

Thanks
Agnes

The org/snmp4j/agent/example/SampleAgentConfig.properties file is exactly meant as example how to provide a consistent security configuration.

changing null to new OctetString() did the trick. I am now able to do snmpwalk.

Sorry Frank I was not making myself clear. What I meant was using java code to add security so I can avoid some of the restrictions like what I shouldn’t use etc.
Also, is it safe to say that if we don’t have data, we should be using new OctetString() instead of passing in null?

For MIB data, you always have to provide a SMI Variable value (null is not allowed). This is true for all MIB modules, because SNMP does not support null values.

Frank got it thanks!