org.snmp4j.Snmp.getUSM()方法的使用及代码示例

x33g5p2x  于2022-01-30 转载在 其他  
字(7.2k)|赞(0)|评价(0)|浏览(350)

本文整理了Java中org.snmp4j.Snmp.getUSM()方法的一些代码示例,展示了Snmp.getUSM()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Snmp.getUSM()方法的具体详情如下:
包路径:org.snmp4j.Snmp
类名称:Snmp
方法名:getUSM

Snmp.getUSM介绍

[英]Gets the User Based Security Model (USM). This is a convenience method that uses the MPv3#getSecurityModel method of the associated MPv3 instance to get the USM.
[中]获取基于用户的安全模型(USM)。这是一种方便的方法,它使用关联MPv3实例的MPv3#getSecurityModel方法来获取USM。

代码示例

代码示例来源:origin: pentaho/pentaho-kettle

new OctetString( passPhrase ) );
USM usm = snmp.getUSM();

代码示例来源:origin: apache/nifi

this.snmp.getUSM().addUser(new OctetString(username),
    new UsmUser(new OctetString(username), SNMPUtils.getAuth(authProtocol), aPwd, SNMPUtils.getPriv(privProtocol), pPwd));

代码示例来源:origin: org.snmp4j/snmp4j

public SnmpURI(Session snmp, Target defaultTarget) throws IOException {
 this.snmp = snmp;
 this.defaultTarget = defaultTarget;
 if (snmp instanceof Snmp) {
  usm = ((Snmp) snmp).getUSM();
 }
}

代码示例来源:origin: org.apache.servicemix.bundles/org.apache.servicemix.bundles.snmp4j

public SnmpURI(Session snmp) throws IOException {
 this.snmp = snmp;
 if (snmp instanceof Snmp) {
  usm = ((Snmp) snmp).getUSM();
 }
}

代码示例来源:origin: org.apache.servicemix.bundles/org.apache.servicemix.bundles.snmp4j

public SnmpURI(Session snmp, Target defaultTarget) throws IOException {
 this.snmp = snmp;
 this.defaultTarget = defaultTarget;
 if (snmp instanceof Snmp) {
  usm = ((Snmp) snmp).getUSM();
 }
}

代码示例来源:origin: org.snmp4j/snmp4j

public SnmpURI(Session snmp) throws IOException {
 this.snmp = snmp;
 if (snmp instanceof Snmp) {
  usm = ((Snmp) snmp).getUSM();
 }
}

代码示例来源:origin: org.snmp4j/snmp4j

private void addUsmUser(Snmp snmp) {
  snmp.getUSM().addUser(securityName, new UsmUser(securityName,
      authProtocol,
      authPassphrase,
      privProtocol,
      privPassphrase));
}

代码示例来源:origin: org.apache.servicemix.bundles/org.apache.servicemix.bundles.snmp4j

private void addUsmUser(Snmp snmp) {
 snmp.getUSM().addUser(securityName, new UsmUser(securityName,
                         authProtocol,
                         authPassphrase,
                         privProtocol,
                         privPassphrase));
}

代码示例来源:origin: org.kaazing/snmp4j

private void addUsmUser(Snmp snmp) {
 snmp.getUSM().addUser(securityName, new UsmUser(securityName,
                         authProtocol,
                         authPassphrase,
                         privProtocol,
                         privPassphrase));
}

代码示例来源:origin: org.snmp4j/snmp4j

public void configure(Snmp snmp, Map<String, List<Object>> settings) {
  configure(snmp, snmp.getUSM(), snmp.getMessageDispatcher(), settings);
}

代码示例来源:origin: stackoverflow.com

snmp.getUSM().addUser(
    new OctetString("MD5DES"),
    new UsmUser(new OctetString("saikrishna"), AuthMD5.ID,

代码示例来源:origin: net.itransformers.snmp2xml4j/snmptoolkit

snmp.getUSM().addUser(new OctetString(ver3Username),
    new UsmUser(new OctetString(ver3Username), null, null, null, null));
snmp.getUSM().addUser(new OctetString(ver3Username),
    new UsmUser(new OctetString(ver3Username), authenticationProtocolOID, new OctetString(ver3AuthPasscode), null, null));
snmp.getUSM().addUser(new OctetString(ver3Username),
    new UsmUser(new OctetString(ver3Username), authenticationProtocolOID, new OctetString(ver3AuthPasscode), privacyProtocolOID, new OctetString(privacyProtocolPassShare)));

代码示例来源:origin: net.itransformers.snmp2xml4j/snmptoolkit

/** {@inheritDoc} */
@Override
protected void doInit() {
    USM usm = new USM(SecurityProtocols.getInstance(), new OctetString(MPv3.createLocalEngineID()), 0);
    SecurityModels.getInstance().addSecurityModel(usm);
    OID authenticationProtocolOID = null;
    if ("MD5".equals(this.authenticationProtocol)) {
      authenticationProtocolOID = AuthMD5.ID;
    } else if ("SHA".equals(authenticationProtocol)) {
      authenticationProtocolOID = AuthSHA.ID;
    }
    OID privacyProtocolOID = null;
    if ("DES".equals(privacyProtocol)) {
      privacyProtocolOID = PrivDES.ID;
    } else if ("3DES".equals(privacyProtocol)) {
      privacyProtocolOID = Priv3DES.ID;
    }
    if (ver3mode == SecurityLevel.NOAUTH_NOPRIV) {
      snmp.getUSM().addUser(new OctetString(ver3Username),
          new UsmUser(new OctetString(ver3Username), null, null, null, null));
    }
    else if (ver3mode == SecurityLevel.AUTH_NOPRIV) {
      snmp.getUSM().addUser(new OctetString(ver3Username),
          new UsmUser(new OctetString(ver3Username), authenticationProtocolOID, new OctetString(ver3AuthPasscode), null, null));
    } else {
      snmp.getUSM().addUser(new OctetString(ver3Username),
          new UsmUser(new OctetString(ver3Username), authenticationProtocolOID, new OctetString(ver3AuthPasscode), privacyProtocolOID, new OctetString(privacyProtocolPassShare)));
    }
}

代码示例来源:origin: org.apache.servicemix.bundles/org.apache.servicemix.bundles.snmp4j

public void configure(Snmp snmp, Map settings) {
 if (snmp.getUSM() != null) {
  configureEngine(snmp, settings);
  String sn = (String)
   OID privProtocol = getPrivProtocolOid(privP);
   OctetString un = createOctetString(sn, null);
   snmp.getUSM().addUser(un, new UsmUser(un,
                      authProtocol,
                      createOctetString(authPP, null),

代码示例来源:origin: org.apache.servicemix.bundles/org.apache.servicemix.bundles.snmp4j

private void configureEngine(Snmp snmp, Map settings) {
 int engineBoots = 0;
 Integer bc =
   (Integer) ArgumentParser.getValue(settings, oBootCounter, 0);
 if (bc != null) {
  engineBoots = bc;
  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);
 }
}

代码示例来源:origin: org.jboss.jbossas/jboss-snmp

if(authorativeEngine != null) {		      
  OctetString authorativeEngineID = new OctetString(authorativeEngine);
  snmp.getUSM().addUser(usmUser.getSecurityName(), authorativeEngineID, usmUser);
  ((UserTarget)target).setAuthoritativeEngineID(authorativeEngine);

代码示例来源:origin: org.mobicents.tools.snmp.adaptor/core

if(authorativeEngine != null) {		      
  OctetString authorativeEngineID = new OctetString(authorativeEngine);
  snmp.getUSM().addUser(usmUser.getSecurityName(), authorativeEngineID, usmUser);
  ((UserTarget)target).setAuthoritativeEngineID(authorativeEngine);

代码示例来源:origin: oVirt/ovirt-engine

private org.snmp4j.Snmp createSnmp3(Profile profile) {
  try {
    TransportMapping<?> transport = new DefaultUdpTransportMapping();
    org.snmp4j.Snmp snmp = new org.snmp4j.Snmp(transport);
    SecurityProtocols securityProtocols = SecurityProtocols.getInstance();
    securityProtocols.addDefaultProtocols();
    securityProtocols.addAuthenticationProtocol(new AuthMD5());
    securityProtocols.addAuthenticationProtocol(new AuthSHA());
    securityProtocols.addPrivacyProtocol(new PrivAES128());
    securityProtocols.addPrivacyProtocol(new PrivAES192());
    securityProtocols.addPrivacyProtocol(new PrivAES256());
    USM usm = new USM(securityProtocols, profile.engineId, 0);
    ((org.snmp4j.mp.MPv3) snmp.getMessageProcessingModel(org.snmp4j.mp.MPv3.ID))
        .setLocalEngineID(profile.engineId.getValue());
    ((org.snmp4j.mp.MPv3) snmp.getMessageProcessingModel(org.snmp4j.mp.MPv3.ID))
        .getSecurityModels().addSecurityModel(usm);
    SecurityModels.getInstance().addSecurityModel(
        usm);
    transport.listen();
    snmp.getUSM().addUser(
        profile.username,
        getUsmUser(profile));
    return snmp;
  } catch (IOException e) {
    throw new NotificationServiceException("error creating version 3 snmp " + getClass().getName());
  }
}

代码示例来源:origin: org.kaazing/snmp4j

USM usm = getUSM();
if (usm != null) {
 usm.removeEngineTime(engineID);

代码示例来源:origin: usdot-jpo-ode/jpo-ode

SecurityModels.getInstance().addSecurityModel(usm);
if (rsu.getRsuUsername() != null) {
 snmp.getUSM().addUser(new OctetString(rsu.getRsuUsername()), new UsmUser(new OctetString(rsu.getRsuUsername()),
    AuthSHA.ID, new OctetString(rsu.getRsuPassword()), null, null));

相关文章