org.snmp4j.security.AuthSHA Java Examples
The following examples show how to use
org.snmp4j.security.AuthSHA.
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: SNMPClient.java From mysql_perf_analyzer with Apache License 2.0 | 6 votes |
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; }
Example #2
Source File: SNMPUtils.java From localization_nifi with Apache License 2.0 | 5 votes |
/** * Method to return the authentication protocol given the property * @param authProtocol property * @return protocol */ public static OID getAuth(String authProtocol) { switch (authProtocol) { case "SHA": return AuthSHA.ID; case "MD5": return AuthMD5.ID; default: return null; } }
Example #3
Source File: SNMPUtils.java From nifi with Apache License 2.0 | 5 votes |
/** * Method to return the authentication protocol given the property * @param authProtocol property * @return protocol */ public static OID getAuth(String authProtocol) { switch (authProtocol) { case "SHA": return AuthSHA.ID; case "MD5": return AuthMD5.ID; default: return null; } }