if (bc != null) {
engineBoots = bc.intValue();
snmp.getUSM().setEngineBoots(engineBoots);
}
int engineTime = 0;
OctetString localEngineID =
createOctetString((String)
ArgumentParser.getValue(settings, oLocalEngineID, 0),
null);
if (localEngineID == null) {
if (snmp.getLocalEngineID() == null) {
snmp.setLocalEngine(MPv3.createLocalEngineID(), engineBoots,
engineTime);
}
}
else {
snmp.setLocalEngine(localEngineID.getValue(), engineBoots, engineTime);
}
String sn = (String)
ArgumentParser.getValue(settings, oSecurityName, 0);
if (sn != null) {
String authPP =
(String) ArgumentParser.getValue(settings, oAuthPassphrase, 0);
String privPP =
(String) ArgumentParser.getValue(settings, oPrivPassphrase, 0);
OID authProtocol = null;
String authP =
(String) ArgumentParser.getValue(settings, oAuthProtocol, 0);
String privP =
(String) ArgumentParser.getValue(settings, oPrivProtocol, 0);
OID privProtocol = null;
if ("MD5".equals(authP)) {
authProtocol = AuthMD5.ID;
}
else if ("SHA".equals(authP)) {
authProtocol = AuthSHA.ID;
}
if ("DES".equals(privP)) {
privProtocol = PrivDES.ID;
}
else if ("3DES".equals(privP)) {
privProtocol = Priv3DES.ID;
}
else if ("AES".equals(privP) || "AES128".equals(privP)) {
privProtocol = PrivAES128.ID;
}
else if ("AES192".equals(privP)) {
privProtocol = PrivAES192.ID;
}
else if ("AES256".equals(privP)) {
privProtocol = PrivAES256.ID;
}
OctetString un = createOctetString(sn, null);
snmp.getUSM().addUser(un, new UsmUser(un,
authProtocol,
createOctetString(authPP, null),
privProtocol,
createOctetString(privPP, null)));