snmp的v3安全级别为AUTH_NOPRIV
我的这个UsmUser该怎么赋值,还是有别的方法,我看到UsmUser只有两个方法,都必须要认证和加密,现在我只想要认证不加密怎么做
```java
if (securityLevel.equals("3")) {
snmp.getUSM().addUser(new OctetString(usmUser), new UsmUser(new OctetString(usmUser), GainOid.gainOidString(authAlgorithm), new OctetString(authPassword), GainOid.gainOidString(privacyAlgorithm), new OctetString(privacyPassword)));
target = new UserTarget();
// 设置安全级别
((UserTarget) target).setSecurityLevel(SecurityLevel.AUTH_PRIV); //安全级别
((UserTarget) target).setSecurityName(new OctetString(usmUser));//安全级别名称
target.setVersion(SnmpConstants.version3);
}
if (securityLevel.equals("2")) {
snmp.getUSM().addUser(new OctetString(usmUser), new UsmUser(new OctetString(usmUser), GainOid.gainOidString(authAlgorithm), new OctetString(authPassword), GainOid.gainOidString(privacyAlgorithm), new OctetString(privacyPassword)));
target = new UserTarget();
// 设置安全级别
((UserTarget) target).setSecurityLevel(SecurityLevel.AUTH_NOPRIV); //安全级别
((UserTarget) target).setSecurityName(new OctetString(usmUser));//安全级别名称
target.setVersion(SnmpConstants.version3);
}
if (securityLevel.equals("1")) {
snmp.getUSM().addUser(new OctetString(usmUser), new UsmUser(new OctetString(usmUser), GainOid.gainOidString(authAlgorithm), new OctetString(authPassword), GainOid.gainOidString(privacyAlgorithm), new OctetString(privacyPassword)));
target = new UserTarget();
// 设置安全级别
((UserTarget) target).setSecurityLevel(SecurityLevel.NOAUTH_NOPRIV); //安全级别
((UserTarget) target).setSecurityName(new OctetString(usmUser));//安全级别名称
target.setVersion(SnmpConstants.version3);
}