当前位置: 首页>>代码示例>>Java>>正文


Java AuthSHA类代码示例

本文整理汇总了Java中org.snmp4j.security.AuthSHA的典型用法代码示例。如果您正苦于以下问题:Java AuthSHA类的具体用法?Java AuthSHA怎么用?Java AuthSHA使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


AuthSHA类属于org.snmp4j.security包,在下文中一共展示了AuthSHA类的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: getTargetV3

import org.snmp4j.security.AuthSHA; //导入依赖的package包/类
private Target getTargetV3() {
	//logger.info("Use SNMP v3, "+this.privacyprotocol +"="+this.password+", "+this.privacyprotocol+"="+this.privacypassphrase);
	OID authOID = AuthMD5.ID;
	if("SHA".equals(this.authprotocol))
		authOID = AuthSHA.ID;
	OID privOID = PrivDES.ID;
	if(this.privacyprotocol == null || this.privacyprotocol.isEmpty())
		privOID = null;
	UsmUser user = new UsmUser(new OctetString(this.username),  
			authOID, new OctetString(this.password),  //auth
			privOID, this.privacypassphrase!=null?new OctetString(this.privacypassphrase):null); //enc
	snmp.getUSM().addUser(new OctetString(this.username), user);  
	Address targetAddress = GenericAddress.parse(address);
	UserTarget target = new UserTarget();
	target.setAddress(targetAddress);
	target.setRetries(2);
	target.setTimeout(1500);
	target.setVersion(this.getVersionInt());
	if(privOID != null)
		target.setSecurityLevel(SecurityLevel.AUTH_PRIV);  
	else
		target.setSecurityLevel(SecurityLevel.AUTH_NOPRIV); 
	target.setSecurityName(new OctetString(this.username));
	return target;
}
 
开发者ID:yahoo,项目名称:mysql_perf_analyzer,代码行数:26,代码来源:SNMPClient.java

示例2: convertAuthProtocol

import org.snmp4j.security.AuthSHA; //导入依赖的package包/类
private OID convertAuthProtocol(String authProtocol) {
    /*
     * Returning null here is okay because the SNMP4J library supports
     * this value as null when creating the SNMP session.
     */
    if (StringUtils.isBlank(authProtocol)) {
        return null;
    }
    
    if (authProtocol.equals("MD5")) {
        return AuthMD5.ID;
    } else if (authProtocol.equals("SHA")) {
        return AuthSHA.ID;
    } else {
        throw new IllegalArgumentException("Authentication protocol unsupported: " + authProtocol);
    }            
}
 
开发者ID:qoswork,项目名称:opennmszh,代码行数:18,代码来源:Snmp4JAgentConfig.java

示例3: convertAuthProtocol

import org.snmp4j.security.AuthSHA; //导入依赖的package包/类
private OID convertAuthProtocol(String authProtocol) {
    /*
     * Returning null here is okay because the SNMP4J library supports
     * this value as null when creating the SNMP session.
     */
    if (authProtocol == null) {
        return null;
    }
    
    if (authProtocol.equals("MD5")) {
        return AuthMD5.ID;
    } else if (authProtocol.equals("SHA")) {
        return AuthSHA.ID;
    } else {
        throw new IllegalArgumentException("Authentication protocol unsupported: " + authProtocol);
    }            
}
 
开发者ID:vishwaabhinav,项目名称:OpenNMS,代码行数:18,代码来源:Snmp4JAgentConfig.java

示例4: convertAuthenticationProtocol

import org.snmp4j.security.AuthSHA; //导入依赖的package包/类
private OID convertAuthenticationProtocol(String authenticationProtocol) {
    if (authenticationProtocol == null) {
        return null;
    }    
    if ("MD5".equals(authenticationProtocol)) {
        return AuthMD5.ID;
    } else if ("SHA1".equals(authenticationProtocol)) {
        return AuthSHA.ID;
    } else {
        throw new IllegalArgumentException("Unknown authentication protocol: " + authenticationProtocol);
    }
}
 
开发者ID:HydAu,项目名称:Camel,代码行数:13,代码来源:SnmpOIDPoller.java

示例5: authType

import org.snmp4j.security.AuthSHA; //导入依赖的package包/类
private OID authType(SnmpV3Target v3Target) {
  switch (v3Target.getAuthType()) {
    case SHA:
      return AuthSHA.ID;
    case MD5:
      return AuthMD5.ID;
    default:
      throw new IllegalArgumentException("unrecognized auth type");
  }
}
 
开发者ID:soulwing,项目名称:tnm4j,代码行数:11,代码来源:UserTargetStrategy.java

示例6: authProtocol

import org.snmp4j.security.AuthSHA; //导入依赖的package包/类
private OID authProtocol() {
    AuthProtocol ap = AuthProtocol.valueOf(conf("authProtocol", AuthProtocol.NONE));
    switch (ap) {
    case MD5: return AuthMD5.ID;
    case SHA: return AuthSHA.ID;
    default: return null;
    }
}
 
开发者ID:genman,项目名称:rhq-plugins,代码行数:9,代码来源:SnmpComponent.java


注:本文中的org.snmp4j.security.AuthSHA类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。