I'm not able to receive and process v3 snmp traps in my snmp4j trap listner

Below is my code for listening to snmp v3 traps but they are not even received but v1 and v2 traps seems to work fine,

transport = new DefaultUdpTransportMapping(new UdpAddress(“0.0.0.0/” + port));
snmp = new Snmp(transport);

    USM usm = new USM(SecurityProtocols.getInstance(), new OctetString(MPv3.createLocalEngineID()), 0);
    SecurityModels.getInstance().addSecurityModel(usm);

    snmp.getUSM().addUser(
            new OctetString("MyUser"),
            new UsmUser(
                    new OctetString("MyUser"),
                    AuthSHA.ID, new OctetString("MyAuthPassword"),
                    PrivAES256.ID, new OctetString("MyPrivPassword")
            )
    );

    // Add all necessary Message Processing Models to the dispatcher
    MessageDispatcher dispatcher = snmp.getMessageDispatcher();
    dispatcher.addMessageProcessingModel(new MPv1());
    dispatcher.addMessageProcessingModel(new MPv2c());
    dispatcher.addMessageProcessingModel(new MPv3());

    snmp.addCommandResponder(this);
    transport.listen();

I have not configured the engine Id in the traps which I’m sending.
Also does snmp4j supports AES256C and SHA256?

snm4j version - 3.7.7
java version - 17

CLI cmd used for sending traps:
snmptrap -v 3 -l authPriv -u MyUser -a SHA -A MyAuthPassword -x AES-256 -X MyPrivPassword localhost:9162 ‘’ 1.3.6.1.6.3.1.1.5.1 1.3.6.1.4.1.9999.1.2.1 s “This is a test v3 trap.”

with engine Id:
snmptrap -v 3 -l authPriv -u MyUser -a SHA -A MyAuthPassword -x AES-256 -X MyPrivPassword -e 0x6d792d7365637572652d656e67696e652d6964 localhost:9162 ‘’ 1.3.6.1.6.3.1.1.5.1 1.3.6.1.4.1.9999.1.2.1 s “This is a test v3 trap.”

My comments:

  1. Have you checked that you added the necessary security protocols like SHA and AES256?
  2. Yes, AES256 is supported in Cisco variant as well. See PrivAES256With3DESKeyExtension.
  3. SHA and AES256 are not compatible. Using this auth protocol and priv protocols together will not work (properly).
  4. Unique engine IDs are essential, they must not be omitted!