[SNMP4J] snmp4j 2.2.5 3DES, AES192/256 not working

NarayanaRao Yenduri ynr_ind at yahoo.com
Fri May 16 11:15:08 CEST 2014


Thanks Frank.
after downloading JCE and correcting JRE, i am not seeing the exception. but traps are not received when i tried with 3DES,AES192 and AES256. 
i enabled packet capture and observed as malformed packet. same is working fine in case of DES and AES128.
Could you please help?
On Thursday, May 15, 2014 12:18 PM, NarayanaRao Yenduri <ynr_ind at yahoo.com> wrote:
 


Thanks Frank.
after downloading JCE and correcting JRE, i am not seeing the exception. but traps are not received when i tried with 3DES,AES192 and AES256. 
i enabled packet capture and observed as malformed packet(attachment in zip file  not_working_with_aes256_cap_filter_udp.port == 8765).
 the same code is working fine with DES and AES128(attachment in zip file - capture - Working_cap_with_DES_filter_udp.port == 8765).


you can apply the filter with String "udp.port == 8765" to see the packets.

could you please suggest me what is going wrong.
On Thursday, May 15, 2014 11:31 AM, NarayanaRao Yenduri <ynr_ind at yahoo.com> wrote:
 
Thanks Frank.
after downloading JCE and correcting JRE, i am not seeing the exception. but traps are not received when i tried with 3DES,AES192 and AES256. 
i enabled packet capture and observed as malformed packet(attached capture not_working_with_aes256_cap_filter_udp.port == 8765).
 the same code is working fine with DES and AES128(attached capture - Working_cap_with_DES_filter_udp.port == 8765).


you can apply the filter with String "udp.port == 8765" to see the packets.

could you please suggest me what is going wrong.


On Sunday, May 11, 2014 2:59 PM, Frank Fock <fock at agentpp.com> wrote:
 
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 <ynr_ind at yahoo.com> 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
> SNMP4J at agentpp.org
> 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
SNMP4J at agentpp.org
https://s16675406.onlinehome-server.info/mailman/listinfo/snmp4j


More information about the SNMP4J mailing list