Hi,
For encryption algorithms using more than 128bit keys (3DES, AES192, and
AES256)
you need to activate strong encryption in the Java Runtime. Please see
Oracle's
documentation on how to do this.
See also the SNMP FAQ at:
https://oosnmp.net/confluence/pages/viewpage.action?pageId=6651906
Best regards,
Frank
Am 11.05.2014 07:12, schrieb NarayanaRao Yenduri:
On Sunday, May 11, 2014 10:32 AM, NarayanaRao Yenduri <[email protected]> wrote:
Hi Team,
i am very new to using snmp4j.
i am using the sample code to get use to this.
https://github.com/mchopker/myprojects/blob/master/TranSenderReceiver/src/SNMPTrapGeneratorClient.java
Following is the method which is working fine for DES and AES128. it is not
working for other protocols.
/**
* Sends the v3 trap
*/
private static void sendSnmpV3AuthTrap() {
try {
long start = System.currentTimeMillis();
Address targetAddress = GenericAddress.parse("udp:" + ipAddress
+ "/" + port);
// Create Transport Mapping
TransportMapping<?> transport = new DefaultUdpTransportMapping();
Snmp snmp = new Snmp(transport);
USM usm = new USM(SecurityProtocols.getInstance(), new OctetString(
MPv3.createLocalEngineID()), 0);
USM usm1 = new USM(SecurityProtocols.getInstance(), new OctetString(
MPv3.createLocalEngineID(new OctetString("80001f88806a05a51f521dfd87"))), 0);
SecurityModels.getInstance().addSecurityModel(usm1);
transport.listen();
snmp.getUSM().addUser(
new OctetString("MD5DES"),
new UsmUser(new OctetString("MD5DES"), AuthMD5.ID,
new OctetString("UserName"), PrivAES128.ID,
new OctetString("UserName")));
// Create Target
UserTarget target = new UserTarget();
target.setAddress(targetAddress);
target.setRetries(1);
// set timeout
target.setTimeout(11500);
target.setVersion(SnmpConstants.version3);
target.setSecurityLevel(SecurityLevel.AUTH_PRIV);
target.setSecurityName(new OctetString("MD5DES"));
// Create PDU for V3
ScopedPDU pdu = new ScopedPDU();
pdu.setType(ScopedPDU.NOTIFICATION);
// need to specify the system up time
long sysUpTime = (System.currentTimeMillis() - start) / 10;
pdu.add(new VariableBinding(SnmpConstants.sysUpTime, new TimeTicks(
sysUpTime)));
// Send the PDU
System.out.println("Sending V3 priv Trap to " + ipAddress + " on Port "
+ port+" time is "+new Date());
snmp.send(pdu, target);
/*snmp.addCommandResponder(new CommandResponder() {
@Override
public void processPdu(CommandResponderEvent arg0) {
System.out.println(arg0);
}
});*/
snmp.close();
} catch (Exception e) {
System.err.println("Error in Sending V3 Trap to " + ipAddress
+ " on Port " + port);
System.err.println("Exception Message = " + e.getMessage());
}
}
i am getting below exception with other modes.
"Exception Message = Message processing model 3 returned error: Encryption
error"
org.snmp4j.MessageException: Message processing model 3 returned error:
Encryption error
at org.snmp4j.MessageDispatcherImpl.sendPdu(MessageDispatcherImpl.java:501)
at org.snmp4j.Snmp.sendMessage(Snmp.java:1004)
at org.snmp4j.Snmp.send(Snmp.java:885)
at org.snmp4j.Snmp.send(Snmp.java:878)
at org.snmp4j.Snmp.send(Snmp.java:843)
at
com.cisco.xbow.hpm.snmp.traps.SNMPTrapGeneratorClient.sendSnmpV3AuthTrap(SNMPTrapGeneratorClient.java:274)
Could you please help me to resolve this.
Thanks in advance,
Narayanarao
_______________________________________________
SNMP4J mailing list
[email protected]
https://s16675406.onlinehome-server.info/mailman/listinfo/snmp4j
--
---
AGENT++
Maximilian-Kolbe-Str. 10
73257 Koengen, Germany
https://agentpp.com
Phone: +49 7024 8688230
Fax: +49 7024 8688231
_______________________________________________
SNMP4J mailing list
[email protected]
https://s16675406.onlinehome-server.info/mailman/listinfo/snmp4j