|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectorg.snmp4j.security.SecurityProtocols
public class SecurityProtocols
The SecurityProtocols class holds all authentication and
privacy protocols for a SNMP entity.
To register security protocols other than the default, set the system
property SECURITY_PROTOCOLS_PROPERTIES to a customized version
of the SecurityProtocols.properties file. The path has to
be specified relatively to this class.
| Field Summary | |
|---|---|
static java.lang.String |
SECURITY_PROTOCOLS_PROPERTIES
|
| Constructor Summary | |
|---|---|
protected |
SecurityProtocols()
|
| Method Summary | |
|---|---|
void |
addAuthenticationProtocol(AuthenticationProtocol auth)
Add the given AuthenticationProtocol. |
void |
addDefaultProtocols()
Add the default SecurityProtocols. |
void |
addPrivacyProtocol(PrivacyProtocol priv)
Add the given PrivacyProtocol. |
AuthenticationProtocol |
getAuthenticationProtocol(OID id)
Get the AuthenticationProtocol with the given ID. |
static SecurityProtocols |
getInstance()
Get an instance of class SecurityProtocols. |
int |
getMaxAuthDigestLength()
Gets the maximum authentication key length of the all known authentication protocols. |
int |
getMaxPrivDecryptParamsLength()
Gets the maximum privacy key length of the currently known privacy protocols. |
PrivacyProtocol |
getPrivacyProtocol(OID id)
Get the PrivacyProtocol with the given ID. |
byte[] |
passwordToKey(OID authProtocolID,
OctetString passwordString,
byte[] engineID)
Generates the localized key for the given password and engine id for the authentication protocol specified by the supplied OID. |
byte[] |
passwordToKey(OID privProtocolID,
OID authProtocolID,
OctetString passwordString,
byte[] engineID)
Generates the localized key for the given password and engine id for the privacy protocol specified by the supplied OID. |
void |
removeAuthenticationProtocol(AuthenticationProtocol auth)
Remove the given AuthenticationProtocol. |
void |
removePrivacyProtocol(PrivacyProtocol priv)
Remove the given PrivacyProtocol. |
static void |
setSecurityProtocols(SecurityProtocols securityProtocols)
Set the SecurityProtocols |
byte[] |
truncateKey(byte[] key,
int maxKeyLength)
Limits the supplied key value to the specified maximum length |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
public static final java.lang.String SECURITY_PROTOCOLS_PROPERTIES
| Constructor Detail |
|---|
protected SecurityProtocols()
| Method Detail |
|---|
public static SecurityProtocols getInstance()
public static void setSecurityProtocols(SecurityProtocols securityProtocols)
SecurityProtocols
securityProtocols - SecurityProtocolspublic void addDefaultProtocols()
java.lang.InternalError - if the properties file cannot be opened/read.public void addAuthenticationProtocol(AuthenticationProtocol auth)
AuthenticationProtocol. If an authentication protocol
with the supplied ID already exists, the supplied authentication protocol
will not be added and the security protocols will not be unchang.
auth - the AuthenticationProtocol to add (an existing authentication protcol
with auth's ID remains unchanged).public AuthenticationProtocol getAuthenticationProtocol(OID id)
AuthenticationProtocol with the given ID.
id - The unique ID (specified as OID) of the AuthenticationProtocol.
public void removeAuthenticationProtocol(AuthenticationProtocol auth)
AuthenticationProtocol.
auth - The protocol to removepublic void addPrivacyProtocol(PrivacyProtocol priv)
PrivacyProtocol. If a privacy protocol
with the supplied ID already exists, the supplied privacy protocol
will not be added and the security protocols will not be changed.
priv - the PrivacyProtocol to add (an existing privacy protcol
with priv's ID remains unchanged).public PrivacyProtocol getPrivacyProtocol(OID id)
id - The unique ID (specified as OID) of the PrivacyProtocol.
PrivacyProtocol object if it was added before,
or null if not.public void removePrivacyProtocol(PrivacyProtocol priv)
PrivacyProtocol.
priv - The protocol to remove
public byte[] passwordToKey(OID authProtocolID,
OctetString passwordString,
byte[] engineID)
authProtocolID - an OID identifying the authentication protocol to
use.passwordString - the authentication pass phrase.engineID - the engine ID of the authoritative engine.
public byte[] passwordToKey(OID privProtocolID,
OID authProtocolID,
OctetString passwordString,
byte[] engineID)
privProtocolID - an OID identifying the privacy protocol the key should
be created for.authProtocolID - an OID identifying the authentication protocol to use.passwordString - the authentication pass phrase.engineID - the engine ID of the authoritative engine.
public int getMaxAuthDigestLength()
SecurityProtocols
instance.public int getMaxPrivDecryptParamsLength()
SecurityProtocols
instance.
public byte[] truncateKey(byte[] key,
int maxKeyLength)
key - the key to truncate.maxKeyLength - the maximum length of the returned key.
min(key.length, maxKeyLength).
|
Copyright 2003-2009 Frank Fock and Jochen Katz (SNMP4J.org) | ||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||