public class UsmUser extends java.lang.Object implements User, java.lang.Comparable, java.lang.Cloneable
UsmUser
class represents USM user providing information
to secure SNMPv3 message exchange. A user is characterized by its security
name and optionally by a authentication protocol and passphrase as well as
a privacy protocol and passphrase.
There are no mutators for the attributes of this class, to prevent inconsistent states in the USM, when a user is changed from outside.
Modifier and Type | Field and Description |
---|---|
private OctetString |
authenticationPassphrase |
private OID |
authenticationProtocol |
private OctetString |
localizationEngineID |
private OctetString |
privacyPassphrase |
private OID |
privacyProtocol |
private OctetString |
securityName |
private static long |
serialVersionUID |
Constructor and Description |
---|
UsmUser(OctetString securityName,
OID authenticationProtocol,
OctetString authenticationPassphrase,
OID privacyProtocol,
OctetString privacyPassphrase)
Creates a USM user.
|
UsmUser(OctetString securityName,
OID authenticationProtocol,
OctetString authenticationPassphrase,
OID privacyProtocol,
OctetString privacyPassphrase,
OctetString localizationEngineID)
Creates a localized USM user.
|
Modifier and Type | Method and Description |
---|---|
java.lang.Object |
clone() |
int |
compareTo(java.lang.Object o)
Compares two USM users by their security names.
|
OctetString |
getAuthenticationPassphrase()
Gets the authentication passphrase.
|
OID |
getAuthenticationProtocol()
Gets the authentication protocol ID.
|
OctetString |
getLocalizationEngineID()
Returns the localization engine ID for which this USM user has been already
localized.
|
OctetString |
getPrivacyPassphrase()
Gets the privacy passphrase.
|
OID |
getPrivacyProtocol()
Gets the privacy protocol ID.
|
int |
getSecurityModel()
Gets the security model ID of the USM.
|
OctetString |
getSecurityName()
Gets the user's security name.
|
boolean |
isLocalized()
Indicates whether the passphrases of this USM user need to be localized
or not (
true is returned in that case). |
java.lang.String |
toString() |
private static final long serialVersionUID
private OctetString securityName
private OctetString authenticationPassphrase
private OctetString privacyPassphrase
private OID authenticationProtocol
private OID privacyProtocol
private OctetString localizationEngineID
public UsmUser(OctetString securityName, OID authenticationProtocol, OctetString authenticationPassphrase, OID privacyProtocol, OctetString privacyPassphrase)
securityName
- the security name of the user (typically the user name).authenticationProtocol
- the authentication protcol ID to be associated with this user. If set
to null
, this user only supports unauthenticated messages.authenticationPassphrase
- the authentication passphrase. If not null
,
authenticationProtocol
must also be not null
.
RFC3414 §11.2 requires passphrases to have a minimum length of 8 bytes.
If the length of authenticationPassphrase
is less than 8
bytes an IllegalArgumentException
is thrown.privacyProtocol
- the privacy protcol ID to be associated with this user. If set
to null
, this user only supports unencrypted messages.privacyPassphrase
- the privacy passphrase. If not null
,
privacyProtocol
must also be not null
.
RFC3414 §11.2 requires passphrases to have a minimum length of 8 bytes.
If the length of authenticationPassphrase
is less than 8
bytes an IllegalArgumentException
is thrown.public UsmUser(OctetString securityName, OID authenticationProtocol, OctetString authenticationPassphrase, OID privacyProtocol, OctetString privacyPassphrase, OctetString localizationEngineID)
securityName
- the security name of the user (typically the user name).authenticationProtocol
- the authentication protcol ID to be associated with this user. If set
to null
, this user only supports unauthenticated messages.authenticationPassphrase
- the authentication passphrase. If not null
,
authenticationProtocol
must also be not null
.
RFC3414 §11.2 requires passphrases to have a minimum length of 8 bytes.
If the length of authenticationPassphrase
is less than 8
bytes an IllegalArgumentException
is thrown.privacyProtocol
- the privacy protcol ID to be associated with this user. If set
to null
, this user only supports unencrypted messages.privacyPassphrase
- the privacy passphrase. If not null
,
privacyProtocol
must also be not null
.
RFC3414 §11.2 requires passphrases to have a minimum length of 8 bytes.
If the length of authenticationPassphrase
is less than 8
bytes an IllegalArgumentException
is thrown.localizationEngineID
- if not null
, the localizationEngineID specifies the
engine ID for which the supplied passphrases are already localized.
Such an USM user can only be used with the target whose engine ID
equals localizationEngineID.public OctetString getSecurityName()
public OID getAuthenticationProtocol()
null
.public OID getPrivacyProtocol()
null
.public OctetString getAuthenticationPassphrase()
null
.public OctetString getPrivacyPassphrase()
null
.public OctetString getLocalizationEngineID()
null
if this USM user is not localized or the SNMP engine
ID of the target for which this user has been localized.public boolean isLocalized()
true
is returned in that case).true
if the passphrases of this USM user represent
localized keys.public int getSecurityModel()
USM.getID()
public int compareTo(java.lang.Object o)
compareTo
in interface java.lang.Comparable
o
- another UsmUser
instance.public java.lang.Object clone()
clone
in class java.lang.Object
public java.lang.String toString()
toString
in class java.lang.Object