通过iReasoning lib发送snmp陷阱时出现异常

时间:2016-12-01 14:43:32

标签: java security snmp

我使用iReasoning lib发送snmp tarps。使用SHA算法发送V3时它工作正常,但在使用SHA224

时抛出异常
java.security.NoSuchAlgorithmException: SHA-224 MessageDigest not available

我正在使用Java 7和iReasoning 6。 是否有Java环境或密码的要求?

public void testSendTrap() throws Exception {

    final SendSNMPTrap SNMPTrap = new SendSNMPTrap();

    String host = "127.0.0.1";
    int port = 162;
    String community = "public";
    String oid = "1.3.6.1.4.1.6876.4.5.1.0.200";
    final Varbinds varbinds = new Varbinds();
    varbinds.setOneVarbind(".1.3.6.1.4.1.6876.4.5.1.2.1", new SnmpOctetString("message"));
    String userName = "Armen";

    byte[] engineID = new byte[] { 0x12, 0x45, 0x65, 0x45, 0x56 , 0x28, 0x12, 0x45, 0x65, 0x45, 0x56 , 0x28 };
    SnmpTrapSender.addV3Params(userName, SnmpConst.SHA224, "password", SnmpConst.AES, "password", engineID, host, port);
    long timeTicks = 0;
    SnmpTrap trap = new SnmpTrap(timeTicks, new SnmpOID(oid));
    SnmpTrapSender.sendTrap(host, port, trap, true, community);
}

0 个答案:

没有答案