com.sun.management.snmp.usm
Class SnmpUserSecurityModel

java.lang.Object
  extended by com.sun.management.internal.snmp.SnmpModelImpl
      extended by com.sun.management.snmp.usm.SnmpUserSecurityModel
All Implemented Interfaces:
com.sun.management.internal.snmp.SnmpModel, com.sun.management.internal.snmp.SnmpSecurityModel, SnmpUsm

public class SnmpUserSecurityModel
extends com.sun.management.internal.snmp.SnmpModelImpl
implements SnmpUsm

FOR INTERNAL USE ONLY. This is the default implementation of the User Security Model defined in RFC 2574, "Usm for Snmp V3".
It handles timeliness, authentication and encryption.
It is compliant with the defined public interface SnmpUsm. It can be replaced by any Usm compliant model. It manages a set of distant engine status (in case of manager use). These engine proxies are storing the distant timeliness related status.

Since:
Java DMK 5.1

Field Summary
 
Fields inherited from interface com.sun.management.snmp.usm.SnmpUsm
ID, MAX_NB_BOOTS, TIME_WINDOW, usmNoAuthProtocol, usmNoPrivProtocol, usmStatsDecryptionErrors, usmStatsNotInTimeWindows, usmStatsUnknownEngineIds, usmStatsUnknownUserNames, usmStatsUnsupportedSecLevels, usmStatsWrongDigests
 
Constructor Summary
SnmpUserSecurityModel(com.sun.management.internal.snmp.SnmpSubSystem subsys, SnmpUsmLcd snmplcd)
          Constructor.
 
Method Summary
 com.sun.management.internal.snmp.SnmpSecurityCache createSecurityCache()
          See SnmpSecurityModel interface for doc.
 SnmpUsmSecurityParameters createUsmSecurityParameters()
          Instantiates the SecurityParameters.
 int generateRequestMsg(com.sun.management.internal.snmp.SnmpSecurityCache cache, int version, int msgId, int msgMaxSize, byte msgFlags, int msgSecurityModel, SnmpSecurityParameters p, byte[] contextEngineId, byte[] contextName, byte[] data, int dataLength, byte[] outputBytes)
          See SnmpSecurityModel interface for doc.
 int generateResponseMsg(com.sun.management.internal.snmp.SnmpSecurityCache cache, int version, int msgId, int msgMaxSize, byte msgFlags, int msgSecurityModel, SnmpSecurityParameters p, byte[] contextEngineId, byte[] contextName, byte[] data, int dataLength, byte[] outputBytes)
          See SnmpSecurityModel interface for doc.
 Long getDecryptionErrorsCounter()
          Gets the decryptionErrorsCounter.
 SnmpUsmEnginePeer getEnginePeer(SnmpEngineId id)
          Gets the peer associated with the passed engine Id.
 SnmpUsmLcd getLcd()
          Gets the Lcd.
 Long getNotInTimeWindowsCounter()
          Gets the notInTimeWindowsCounter.
 int getTimelinessWindow()
          Get the time window used for timeliness checks.
 Long getUnknownEngineIdsCounter()
          Gets the unknownEngineIdsCounter.
 Long getUnknownUserNamesCounter()
          Gets the unknownUserNamesCounter.
 Long getUnsupportedSecLevelsCounter()
          Gets the unsupportedSecLevelsCounter.
 Long getWrongDigestsCounter()
          Gets the wrongDigestsCounter.
 SnmpSecurityParameters processIncomingRequest(com.sun.management.internal.snmp.SnmpSecurityCache cache, int version, int msgId, int msgMaxSize, byte msgFlags, int msgSecurityModel, byte[] msgSecurityParameters, byte[] contextEngineId, byte[] contextName, byte[] data, byte[] encryptedPdu, com.sun.management.internal.snmp.SnmpDecryptedPdu decryptedPdu)
          See SnmpSecurityModel interface for doc.
 SnmpSecurityParameters processIncomingResponse(com.sun.management.internal.snmp.SnmpSecurityCache cache, int version, int msgId, int msgMaxSize, byte msgFlags, int msgSecurityModel, byte[] msgSecurityParameters, byte[] contextEngineId, byte[] contextName, byte[] data, byte[] encryptedPdu, com.sun.management.internal.snmp.SnmpDecryptedPdu decryptedPdu)
          See SnmpSecurityModel interface for doc.
 void releaseSecurityCache(com.sun.management.internal.snmp.SnmpSecurityCache cache)
          See SnmpSecurityModel interface for doc.
 void setLcd(SnmpUsmLcd lcd)
          Sets the specified Lcd.
 void setTimelinessWindow(int t)
          Set the time window used for timeliness checks.
 
Methods inherited from class com.sun.management.internal.snmp.SnmpModelImpl
getName, getSubSystem
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface com.sun.management.internal.snmp.SnmpModel
getName, getSubSystem
 

Constructor Detail

SnmpUserSecurityModel

public SnmpUserSecurityModel(com.sun.management.internal.snmp.SnmpSubSystem subsys,
                             SnmpUsmLcd snmplcd)
Constructor. Registered in the sub system using the model Id.

Method Detail

getTimelinessWindow

public int getTimelinessWindow()
Get the time window used for timeliness checks. If non are set, the SnmpUsm.TIMEWINDOW is the default used.

Specified by:
getTimelinessWindow in interface SnmpUsm
Returns:
The time window in seconds.

setTimelinessWindow

public void setTimelinessWindow(int t)
Set the time window used for timeliness checks. If non are set, the SnmpUsm.TIMEWINDOW is the default used.

Specified by:
setTimelinessWindow in interface SnmpUsm
Parameters:
t - The time window in seconds.

getLcd

public SnmpUsmLcd getLcd()
Gets the Lcd.

Specified by:
getLcd in interface SnmpUsm
Returns:
The Lcd.

setLcd

public void setLcd(SnmpUsmLcd lcd)
Sets the specified Lcd.

Specified by:
setLcd in interface SnmpUsm
Parameters:
lcd - The Lcd.

getUnsupportedSecLevelsCounter

public Long getUnsupportedSecLevelsCounter()
Gets the unsupportedSecLevelsCounter.

Specified by:
getUnsupportedSecLevelsCounter in interface SnmpUsm
Returns:
The unsupportedSecLevelsCounter.

getNotInTimeWindowsCounter

public Long getNotInTimeWindowsCounter()
Gets the notInTimeWindowsCounter.

Specified by:
getNotInTimeWindowsCounter in interface SnmpUsm
Returns:
The notInTimeWindowsCounter.

getUnknownUserNamesCounter

public Long getUnknownUserNamesCounter()
Gets the unknownUserNamesCounter.

Specified by:
getUnknownUserNamesCounter in interface SnmpUsm
Returns:
The unknownUserNamesCounter.

getUnknownEngineIdsCounter

public Long getUnknownEngineIdsCounter()
Gets the unknownEngineIdsCounter.

Specified by:
getUnknownEngineIdsCounter in interface SnmpUsm
Returns:
The unknownEngineIdsCounter.

getWrongDigestsCounter

public Long getWrongDigestsCounter()
Gets the wrongDigestsCounter.

Specified by:
getWrongDigestsCounter in interface SnmpUsm
Returns:
The wrongDigestsCounter.

getDecryptionErrorsCounter

public Long getDecryptionErrorsCounter()
Gets the decryptionErrorsCounter.

Specified by:
getDecryptionErrorsCounter in interface SnmpUsm
Returns:
The decryptionErrorsCounter.

getEnginePeer

public SnmpUsmEnginePeer getEnginePeer(SnmpEngineId id)
Gets the peer associated with the passed engine Id.

Specified by:
getEnginePeer in interface SnmpUsm
Parameters:
id - The SNMP engine Id.
Returns:
The peer.

createUsmSecurityParameters

public SnmpUsmSecurityParameters createUsmSecurityParameters()
Instantiates the SecurityParameters.

Specified by:
createUsmSecurityParameters in interface SnmpUsm
Returns:
Empty security parameters.

createSecurityCache

public com.sun.management.internal.snmp.SnmpSecurityCache createSecurityCache()
See SnmpSecurityModel interface for doc.

Specified by:
createSecurityCache in interface com.sun.management.internal.snmp.SnmpSecurityModel
Returns:
The model dependent security cache.

releaseSecurityCache

public void releaseSecurityCache(com.sun.management.internal.snmp.SnmpSecurityCache cache)
See SnmpSecurityModel interface for doc.

Specified by:
releaseSecurityCache in interface com.sun.management.internal.snmp.SnmpSecurityModel
Parameters:
cache - The security cache to release.

generateResponseMsg

public int generateResponseMsg(com.sun.management.internal.snmp.SnmpSecurityCache cache,
                               int version,
                               int msgId,
                               int msgMaxSize,
                               byte msgFlags,
                               int msgSecurityModel,
                               SnmpSecurityParameters p,
                               byte[] contextEngineId,
                               byte[] contextName,
                               byte[] data,
                               int dataLength,
                               byte[] outputBytes)
                        throws SnmpTooBigException,
                               SnmpStatusException,
                               SnmpSecurityException
See SnmpSecurityModel interface for doc.

Specified by:
generateResponseMsg in interface com.sun.management.internal.snmp.SnmpSecurityModel
Parameters:
cache - The cache that has been created by calling createSecurityCache on this model.
version - The SNMP protocol version.
msgId - The current request id.
msgMaxSize - The message max size.
msgFlags - The message flags (reportable, authentication and privacy)
msgSecurityModel - This current security model.
p - The security parameters that contain the model dependent parameters.
contextEngineId - The context engine ID.
contextName - The context name.
data - The marshalled varbind list.
dataLength - The marshalled varbind list length.
outputBytes - The buffer to fill with secured request. This is a representation independent marshalled format. This buffer will be sent to the network.
Returns:
The marshalled byte number.
Throws:
SnmpTooBigException
SnmpStatusException
SnmpSecurityException

generateRequestMsg

public int generateRequestMsg(com.sun.management.internal.snmp.SnmpSecurityCache cache,
                              int version,
                              int msgId,
                              int msgMaxSize,
                              byte msgFlags,
                              int msgSecurityModel,
                              SnmpSecurityParameters p,
                              byte[] contextEngineId,
                              byte[] contextName,
                              byte[] data,
                              int dataLength,
                              byte[] outputBytes)
                       throws SnmpTooBigException,
                              SnmpStatusException,
                              SnmpSecurityException
See SnmpSecurityModel interface for doc.

Specified by:
generateRequestMsg in interface com.sun.management.internal.snmp.SnmpSecurityModel
Parameters:
cache - The cache that has been created by calling createSecurityCache on this model.
version - The SNMP protocol version.
msgId - The current request id.
msgMaxSize - The message max size.
msgFlags - The message flags (reportable, authentication and privacy).
msgSecurityModel - This current security model.
p - The security parameters that contain the model dependent parameters.
contextEngineId - The context engine ID.
contextName - The context name.
data - The marshalled varbind list.
dataLength - The marshalled varbind list length.
outputBytes - The buffer to fill with secured request. This is a representation independent marshalled format. This buffer will be sent to the network.
Returns:
The marshalled byte number.
Throws:
SnmpTooBigException
SnmpStatusException
SnmpSecurityException

processIncomingRequest

public SnmpSecurityParameters processIncomingRequest(com.sun.management.internal.snmp.SnmpSecurityCache cache,
                                                     int version,
                                                     int msgId,
                                                     int msgMaxSize,
                                                     byte msgFlags,
                                                     int msgSecurityModel,
                                                     byte[] msgSecurityParameters,
                                                     byte[] contextEngineId,
                                                     byte[] contextName,
                                                     byte[] data,
                                                     byte[] encryptedPdu,
                                                     com.sun.management.internal.snmp.SnmpDecryptedPdu decryptedPdu)
                                              throws SnmpStatusException,
                                                     SnmpSecurityException
See SnmpSecurityModel interface for doc.

Specified by:
processIncomingRequest in interface com.sun.management.internal.snmp.SnmpSecurityModel
Parameters:
cache - The cache that has been created by calling createSecurityCache on this model.
version - The SNMP protocol version.
msgId - The current request id.
msgMaxSize - The message max size.
msgFlags - The message flags (reportable, authentication and privacy)
msgSecurityModel - This current security model.
msgSecurityParameters - The security parameters in a marshalled format. The informations contained in this array are model dependent.
contextEngineId - The context engine ID or null if encrypted.
contextName - The context name or null if encrypted.
data - The marshalled varbind list or null if encrypted
encryptedPdu - The encrypted pdu or null if not encrypted.
decryptedPdu - The decrypted pdu. If no decryption is to be done, the passed context engine ID, context name and data could be used to fill this object.
Returns:
The decoded security parameters.
Throws:
SnmpStatusException
SnmpSecurityException

processIncomingResponse

public SnmpSecurityParameters processIncomingResponse(com.sun.management.internal.snmp.SnmpSecurityCache cache,
                                                      int version,
                                                      int msgId,
                                                      int msgMaxSize,
                                                      byte msgFlags,
                                                      int msgSecurityModel,
                                                      byte[] msgSecurityParameters,
                                                      byte[] contextEngineId,
                                                      byte[] contextName,
                                                      byte[] data,
                                                      byte[] encryptedPdu,
                                                      com.sun.management.internal.snmp.SnmpDecryptedPdu decryptedPdu)
                                               throws SnmpStatusException,
                                                      SnmpSecurityException
See SnmpSecurityModel interface for doc.

Specified by:
processIncomingResponse in interface com.sun.management.internal.snmp.SnmpSecurityModel
Parameters:
cache - The cache that has been created by calling createSecurityCache on this model.
version - The SNMP protocol version.
msgId - The current request id.
msgMaxSize - The message max size.
msgFlags - The message flags (reportable, authentication and privacy)
msgSecurityModel - This current security model.
msgSecurityParameters - The security parameters in a marshalled format. The informations contained in this array are model dependent.
contextEngineId - The context engine ID or null if encrypted.
contextName - The context name or null if encrypted.
data - The marshalled varbind list or null if encrypted
encryptedPdu - The encrypted pdu or null if not encrypted.
decryptedPdu - The decrypted pdu. If no decryption is to be done, the passed context engine ID, context name and data could be used to fill this object.
Returns:
The security parameters.
Throws:
SnmpStatusException
SnmpSecurityException

Open Source build 02
opendmk-1.0-b02 2007.10.01_19:17:46_MEST

Copyright 1998-2007 Sun Microsystems, Inc. All rights reserved. Use is subject to license terms.