[SNMP4J] Passphrase initialization issue

Ole Karlson ole at dbwatch.no
Sun Sep 4 22:24:08 CEST 2011


I'm having strange issues when setting the passphrases, the following 
works (traps are sent, and recevied ok):

protected void addUsmUser(USM usm) {
     UsmUser user = new UsmUser(new OctetString(getSsecurityName()),
                 AuthSHA.ID,
                 new OctetString("my_password"),
                 PrivAES128.ID,
                 new OctetString("my_password"));
     usm.addUser(user.getSecurityName(), usm.getLocalEngineID(), user);
}

While the following does not work:
private String getMyPassword() {
     return "my_password";
}

protected void addUsmUser(USM usm) {
     UsmUser user = new UsmUser(new OctetString(getSsecurityName()),
                 AuthSHA.ID,
                 new OctetString(getMyPassword()),
                 PrivAES128.ID,
                 new OctetString(getMyPassword()));
     usm.addUser(user.getSecurityName(), usm.getLocalEngineID(), user);
}

In other words, when using a hardcoded password to initialize the 
OctetString everything works ok, and when the OctetString is initialized 
by a String variable with the same value it does not work. What am I 
missing?

Regards
Ole



More information about the SNMP4J mailing list