User-based Security Model for version 3 of the
                Simple Network Management Protocol (SNMPv3)
                            U. Blumenthal
                       IBM T. J. Watson Research
                           uri@watson.ibm.com

                              B. Wijnen
                       IBM T. J. Watson Research
                          wijnen@vnet.ibm.com

                    <draft-ietf-snmpv3-usec-00.txt>

                    <draft-ietf-snmpv3-usec-01.txt>

                          Status of this Memo

This document is an Internet-Draft.  Internet-Drafts are working
documents of the Internet Engineering Task Force (IETF), its areas,
and its working groups.  Note that other groups may also distribute
working documents as Internet-Drafts.

Internet-Drafts are draft documents valid for a maximum of six months
and may be updated, replaced, or obsoleted by other documents at any
time.  It is inappropriate to use Internet- Drafts as reference
material or to cite them other than as ``work in progress.''

To learn the current status of any Internet-Draft, please check the
``1id-abstracts.txt'' listing contained in the Internet- Drafts Shadow
Directories on ds.internic.net (US East Coast), nic.nordu.net (Europe),
ftp.isi.edu (US West Coast), or munnari.oz.au (Pacific Rim).

                          Abstract

This document describes the User-based Security Model (USEC) for SNMP
version 3 for use in the SNMPng SNMP architecture [SNMPng-ARCH]. [SNMP-ARCH].  This
document defines the Elements of Procedure for providing SNMP message
level security.  This document also includes a MIB for remotely
monitoring/managing the configuration parameters for this Security
model.

0.1 Issues
     - Do we indeed want to move all STATS counters to MPC, we
       have assumed so for now.
     - Do we need to do group mapping here and pass it back to MPC
       we have assumed so for now... but other documents do not pass
       groupName around.

Blumenthal/Wijnen         Expires November December  1997               [Page  1]

0.
     - Do we want to check reportableFlag to determine if caching
       of securityData is needed or not.

0.2 Change Log

   [version 1.2]
     - changed (simplified) time sync in section 3 item 7.
     - added usecUserMiId
     - cleaned up text
     - defined IV "salt" generation
     - removed Statistics counters (now in MPC) and reportPDU
       generation (now in MPC)
     - Removed auth and des MIBs which are now merged into USEC MIB
     - specified where cachedSecurityData needs to be discarded
     - added abtract service interface definitions
     - removed section on error reporting (is MPC responsibility)
     - removed auth/priv protocol definitions, they are in ARCH now
     - removed MIB definitions for snmpEngineID,Time,Boots. They
       are in ARCH now.

   [version 1.1]
     - removed <securityCookie>.
     - added <securityIdentity>, <securityCachedData>.
     - added abstract function interface description of
       inter-module communications.
     - modified IV generation process to accomodate messages produced
       faster than one-per-second (still open).
     - always update the clock regardless of whether incoming message
       was Report or not (if the message was properly authenticated
       and its timestamp is ahead of our notion of their clock).

   [version 1.0]
     - first version posted to the v3editors mailing list.
     - based on v2adv slides, v2adv items and issues list and on
       RFC1910 and SNMPv2u and SNMPv2* documents.
     - various iterations were done by the authors via private email.

Blumenthal/Wijnen         Expires November December  1997               [Page  2]

1.  Introduction

   Please refer to the introduction of the SNMP Architectural model
   [SNMPng-ARCH]

   The Architecture for describing Internet Management Frameworks
   is composed of multiple subsystems:
     1) a message processing and control subsystem,
     2) a security subsystem,
     3) an overall introduction access control subsystem, and
     4) orangelets.

   It is important to understand the SNMP components.
   That same document explains architecture and the
   terminology of the architecture to understand where the model
   described in this document fits into the various SNMP
   components architecture and documents. interacts
   with other subsystems within the architecture.  The reader is
   expected to have read and understood the description of the SNMP
   architecture, as defined in [SNMP-ARCH].

   This memo [SNMPv3-USEC] describes the User-Based Security model
   as it is used within the SNMPng Architectural model. SNMP Architecture. The main idea is that
   we use the traditional concept of a user (identified by a userName)
   to associate security information with.

   This memo describes the use of Keyed-MD5 as the authentication
   protocol and the use of CBC-DES as the privacy protocol.
   The User-based Security model however allows for other such
   protocols to be used instead of or concurrent with these protocols.
   So the description of Keyed-MD5 and CBC-DES are in separate sections.
   That way it shows that they are supposed to be self-contained
   pieces that can be replaced or supplemented in the future.

1.1.  Threats

   Several of the classical threats to network protocols are applicable
   to the network management problem and therefore would be applicable
   to any SNMPv3 SNMP security model.  Other threats are not applicable to
   the network management problem.  This section discusses principal
   threats, secondary threats, and threats which are of lesser
   importance.

   The principal threats against which this SNMPv3 security model
   should provide protection are:

   - Modification of Information
     The modification threat is the danger that some unauthorized entity
     may alter in-transit SNMPv3 messages generated on behalf of an
     authorized user in such a way as to effect unauthorized management
     operations, including falsifying the value of an object.

   - Masquerade
     The masquerade threat is the danger that management operations not
     authorized for some user may be attempted by assuming the identity
     of another user that has the appropriate authorizations.

Blumenthal/Wijnen         Expires December  1997               [Page  3]
   Two secondary threats are also identified.  The security protocols
   defined in this memo provide limited protection against:

   - Disclosure
     The disclosure threat is the danger of eavesdropping on the
     exchanges between managed agents and a management station.
     Protecting against this threat may be required as a matter of
     local policy.

Blumenthal/Wijnen         Expires November  1997               [Page  3]

   - Message Stream Modification
     The SNMPv3 protocol is typically based upon a connection-less
     transport service which may operate over any sub-network service.
     The re-ordering, delay or replay of messages can and does occur
     through the natural operation of many such sub-network services.
     The message stream modification threat is the danger that messages
     may be maliciously re-ordered, delayed or replayed to an extent
     which is greater than can occur through the natural operation of a
     sub-network service, in order to effect unauthorized management
     operations.

   There are at least two threats that an SNMPv3 security protocol need
   not protect against.  The security protocols defined in this memo do
   not provide protection against:

   - Denial of Service
     An SNMPv3 security protocol need not attempt to address the broad
     range of attacks by which service on behalf of authorized users is
     denied.  Indeed, such denial-of-service attacks are in many cases
     indistinguishable from the type of network failures with which any
     viable network management protocol must cope as a matter of course.
   - Traffic Analysis
     In addition, an SNMPv3 security protocol need not attempt to
     address traffic analysis attacks.  Indeed, many traffic patterns
     are predictable - agents may be managed on a regular basis by a
     relatively small number of management stations - and therefore
     there is no significant advantage afforded by protecting against
     traffic analysis.

1.2.  Goals and Constraints

   Based on the foregoing account of threats in the SNMP network
   management environment, the goals of this SNMPv3 security model are
   as follows.

   1) The protocol should provide for verification that each received
      SNMPv3 message has not been modified during its transmission
      through the network in such a way that an unauthorized management
      operation might result.

   2) The protocol should provide for verification of the identity of

Blumenthal/Wijnen         Expires December  1997               [Page  4]
      the user on whose behalf a received SNMPv3 message claims to have
      been generated.

   3) The protocol should provide for detection of received SNMPv3
      messages, which request or contain management information, whose
      time of generation was not recent.

   4) The protocol should provide, when necessary, that the contents of
      each received SNMPv3 message are protected from disclosure.

Blumenthal/Wijnen         Expires November  1997               [Page  4]

   In addition to the principal goal of supporting secure network
   management, the design of this SNMPv3 security model is also
   influenced by the following constraints:

   1) When the requirements of effective management in times of network
      stress are inconsistent with those of security, the design should
      prefer the former.

   2) Neither the security protocol nor its underlying security
      mechanisms should depend upon the ready availability of other
      network services (e.g., Network Time Protocol (NTP) or key
      management protocols).

   3) A security mechanism should entail no changes to the basic SNMP
      network management philosophy.

1.3.  Security Services

   The security services necessary to support the goals of an SNMPv3
   security model are as follows.

   - Data Integrity
     is the provision of the property that data has not been altered or
     destroyed in an unauthorized manner, nor have data sequences been
     altered to an extent greater than can occur non-maliciously.

   - Data Origin Authentication
     is the provision of the property that the claimed identity of the
     user on whose behalf received data was originated is corroborated.

   - Data Confidentiality
     is the provision of the property that information is not made
     available or disclosed to unauthorized individuals, entities, or
     processes.

   For the protocols specified in this memo, it is not possible to
   assure the specific originator of a received SNMPv3 message; rather,
   it is the user on whose behalf the message was originated that is
   authenticated.

   For these protocols, it not possible to obtain data integrity without

Blumenthal/Wijnen         Expires December  1997               [Page  5]
   data origin authentication, nor is it possible to obtain data origin
   authentication without data integrity.  Further, there is no
   provision for data confidentiality without both data integrity and
   data origin authentication.

   The security protocols used in this memo are considered acceptably
   secure at the time of writing.  However, the procedures allow for new
   authentication and privacy methods to be specified at a future time
   if the need arises.

Blumenthal/Wijnen         Expires November  1997               [Page  5]

1.4.  Implementation Organization

   The security protocols defined in this memo are implemented in three
   different modules and each have their specific responsibilities such
   that together they realize the goals and security services described
   above:

   - The timeliness module must provide for:

     - Protection against message delay or replay (to an extent greater
       than can occur through normal operation)

   - The authentication module must provide for:

     - Data Integrity,

     - Data Origin Authentication

   - The privacy module must provide for

     - Protection against disclosure of the message payload.

   The timeliness module is fixed for this User-based Security model
   while there is provision for multiple authentication and/or privacy
   modules, each of which implements a specific authentication or
   privacy protocol respectively.

1.4.1.  Timeliness Module

   Section 3 (Elements of procedure) uses the time values in an SNMPv3
   message to do timeliness checking. The timeliness check is only
   performed if authentication is applied to the message. Since the
   complete message is checked for integrity, we can assume that the
   time values in a message that passes the authentication module are
   trustworthy.

1.4.2.  Authentication Protocol

   Section 6 describes the Keyed-MD5 authentication protocol which is
   the first authentication protocol to be used with the User-based
   Security model. In the future additional or replacement

Blumenthal/Wijnen         Expires December  1997               [Page  6]
   authentication protocols may be defined as new needs arise.

   This User-based Security model prescribes that the complete message
   is checked for integrity in the authentication module.

   For a message to be authenticated, it needs to pass authentication
   check by the authentication module and the timeliness check which
   is a fixed part of this User-based Security model.

Blumenthal/Wijnen         Expires November  1997               [Page  6]

1.4.3.  Privacy Protocol

   Section 7 describes the CBC-DES Symmetric Encryption Protocol which
   the first privacy protocol to be used with the User-based Security
   model.  In the future additional or replacement privacy protocols
   may be defined as new needs arise.

   This User-based Security model prescribes that the scopedPDU
   is protected from disclosure when a message is sent with privacy.

   This User-based Security model also prescribes that a message needs
   to be authenticated if privacy is in use.

1.5  Mechanisms to protect  Protection against Message Replay, Delay and Redirection

1.5.1   Authoritative SNMP Engine

   In order to protect against message replay, delay and redirection,
   one of the SNMP engines involved in each communication is designated
   to be the authoritative engine.  For messages with a GET, GETNEXT,
   GETBULK, SET or INFORM request as the payload, the receiver of such
   messages is authoritative.  For messages with a SNMPv2-TRAP,
   RESPONSE  or REPORT as the payload, the sender is authoritative.

1.5.2   The following mechanisms are used:

   - To protect against the threat of message delay or replay (to an
     extent greater than can occur through normal operation), a set of
     time (at the authoritative source) indicators and a request-id are
     included in each message generated.  An SNMPv3 engine evaluates
     the time indicators to determine if a received message is recent.
     An SNMPv3 engine may evaluate the time indicators to ensure that
     a received message is at least as recent as the last message it
     received from the same source.  A non-authoritative SNMPv3 engine
     uses received authentic messages to advance its notion of time at
     the remote authoritative source.  An SNMPv3 engine also evaluates
     the request-id in received Response messages and discards messages
     which do not correspond to outstanding requests.

     These mechanisms provide for the detection of messages whose time
     of generation was not recent in all but one circumstance; this
     circumstance is the delay or replay of a Report message (sent to a

Blumenthal/Wijnen         Expires December  1997               [Page  7]
     receiver) when the receiver has has not recently communicated with
     the source of the Report message.  In this circumstance, the
     detection guarantees only that the Report message is more recent
     than the last communication between source and destination of the
     Report message.  However, Report messages do not request or contain
     management information, and thus, goal #3 in Section 1.2 above is
     met; further, Report messages can at most cause the receiver to
     advance its notion of time (at the source) by less than the proper
     amount.

Blumenthal/Wijnen         Expires November  1997               [Page  7]

     This protection against the threat of message delay or replay does
     not imply nor provide any protection against unauthorized deletion
     or suppression of messages. Also, an SNMPv3 engine may not be able
     to detect message reordering if all the messages involved are sent
     within the Time Window interval.  Other mechanisms defined
     independently of the security protocol can also be used to detect
     the re-ordering replay, deletion, or suppression of messages
     containing set operations (e.g., the MIB variable snmpSetSerialNo
     [RFC1907]).

   - verifying that a message sent to/from one SNMPv3 engine cannot be
     replayed to/as-if-from another SNMPv3 engine.

     Included in each message is an identifier unique to the SNMPv3
     engine associated with the sender or intended recipient of the
     message.  Also, each message containing a Response PDU contains a
     request-id which associates the message to a recently generated
     request.

     A Report message sent by one SNMPv3 engine to a second SNMPv3
     engine can potentially be replayed to another SNMPv3 engine.
     However, Report messages do not request or contain management
     information, and thus, goal #3 in Section 1.2 above is met;
     further, Report messages can at most cause the receiver to advance
     its notion of time (at the authoritative source) by less than the
     correct amount.

   - detecting messages which were not recently generated.

     A set of time indicators are included in the message, indicating
     the time of generation.  Messages (other than those containing
     Report PDUs) without recent time indicators are not considered
     authentic.  In addition, messages containing Response PDUs have a
     request-id; if the request-id does not match that of a recently
     generated request, then the message is not considered to be
     authentic.

     A Report message sent by an SNMPv3 engine can potentially be
     replayed at a later time to an SNMPv3 engine which has not
     recently communicated with that source engine.  However, Report
     messages do not request or contain management information, and

Blumenthal/Wijnen         Expires December  1997               [Page  8]
     thus, goal #3 in Section 1.2 above is met; further, Report
     messages can at most cause the receiver to advance its notion of
     time (at the authoritative source) by less than the correct
     amount.

   This memo allows the same user to be defined on multiple SNMPv3
   engines.  Each SNMPv3 engine maintains a value, snmpEngineID,
   which uniquely identifies the engine.  This value is included in
   each message sent to/from the engine that is authoritative (see
   section 1.5.1).  On receipt of a message, an authoritative engine
   checks the value to ensure it is the intended recipient, and a
   non-authoritative engine uses the value to ensure that the message
   is processed

Blumenthal/Wijnen         Expires November  1997               [Page  8] using the correct state information.

   Each SNMPv3 engine maintains two values, engineBoots and engineTime,
   which taken together provide an indication of time at that engine.
   Both of these values are included in an authenticated message sent
   to/received from that engine. On receipt, the values are checked to
   ensure that the indicated time is within a time window of the
   current time.  The time window represents an administrative upper
   bound on acceptable delivery delay for protocol messages.

   For an SNMPv3 engine to generate a message which an authoritative
   engine will accept as authentic, and to verify that a message
   received from that authoritative engine is authentic, such an engine
   must first achieve time synchronization with the authoritative
   engine.

Blumenthal/Wijnen         Expires November December  1997               [Page  9]

2.  Elements of the Model

   This section contains definitions required to realize the security
   model defined by this memo.

2.1.  SNMPv3 Users

   Management operations using this security model make use of a defined
   set of user identities.  For any SNMPv3 user on whose behalf
   management operations are authorized at a particular SNMPv3 engine,
   that engine must have knowledge of that user.  An SNMPv3 engine that
   wishes to communicate with another SNMPv3 engine must also have
   knowledge of a user known to that engine, including knowledge of the
   applicable attributes of that user.

   A user and its attributes are defined as follows:

   <userName>
     An octet
     A string representing the name of the user.

   <miId>
     A human-readable string representing a (security) model
     independent identity for this user.

   <groupName>
     An octet
     A string representing the group that the user belongs to.

   <authProtocol>
     An indication of whether messages sent on behalf of this user can
     be authenticated, and if so, the type of authentication protocol
     which is used.  One such protocol is defined in this memo: the
     Digest Authentication Protocol.

   <authKey>
     If messages sent on behalf of this user can be authenticated, the
     (private) authentication key for use with the authentication
     protocol.  Note that a user's authentication key will normally be
     different at different authoritative engines. Not visible via
     remote access.

   <authKeyChange>
     The only way to remotely update the authentication key. Does that
     in a secure manner, so that the update can be completed without
     the need to employ privacy protection.

   <privProtocol>
     An indication of whether messages sent on behalf of this user can
     be protected from disclosure, and if so, the type of privacy
     protocol which is used.  One such protocol is defined in this memo:
     the Symmetric DES-based Encryption Protocol.

   <privKey>
     If messages sent on behalf of this user can be en/decrypted, the
     (private) privacy key for use with the privacy protocol. Note that
     a user's privacy key will normally be different at different
     authoritative engines. Not visible via remote access.

   <privKeyChange>
     The only way to remotely update the encryption key. Does that
     in a secure manner, so that the update can be completed without
     the need to employ privacy protection.

2.2.  Replay Protection

   Each SNMPv3 engine maintains three objects:

   - snmpEngineID, which is an identifier unique among all SNMPv3
     engines in (at least) an administrative domain;

   - engineBoots, which is a count of the number of times the engine has
     re-booted/re-initialized since snmpEngineID was last configured;
     and,

   - engineTime, which is the number of seconds since engineBoots was
     last incremented.

   Each SNMPv3 engine is always authoritative with respect to these
   objects in its own engine.  It is the responsibility of a non-
   authoritative SNMPv3 engine to synchronize with the authoritative
   engine, as appropriate.

   An authoritative SNMPv3 engine is required to maintain the values of
   its snmpEngineID and engineBoots in non-volatile storage.

2.2.1.  snmpEngineID

   The engineID value contained in an authenticated message is used to
   defeat attacks in which messages from one engine to another engine
   are replayed to a different engine.

   When an authoritative engine is first installed, it sets its local
   value of snmpEngineID according to a enterprise-specific algorithm
   (see the definition of engineID in the SNMPng Architectural model SNMP Architecture document [SNMPng-ARCH]).
   [SNMP-ARCH]).

2.2.2.  engineBoots and engineTime

   The engineBoots and engineTime values contained in an authenticated
   message are used to defeat attacks in which messages are replayed
   when they are no longer valid.  Through use of engineBoots and
   engineTime, there is no requirement for an SNMPv3 engine to have a
   non-volatile clock which ticks (i.e., increases with the passage of
   time) even when the engine is powered off.  Rather, each time an
   SNMPv3 engine re-boots, it retrieves, increments, and then stores
   engineBoots in non-volatile storage, and resets engineTime to zero.

   When an SNMPv3 engine is first installed, it sets its local values
   of engineBoots and engineTime to zero.  If engineTime ever
   reaches its maximum value (2147483647), then engineBoots is
   incremented as if the engine has re-booted and engineTime is reset to
   zero and starts incrementing again.

   Each time an authoritative SNMPv3 engine re-boots, any SNMPv3 engines
   holding that authoritative engine's values of engineBoots and
   engineTime need to re-synchronize prior to sending correctly
   authenticated messages to that authoritative engine (see Section
   2.4
   2.3 for (re-)synchronization procedures).  Note, however, that the
   procedures do provide for a notification to be accepted as authentic
   by a receiving engine, when sent by an authoritative engine which has
   re-booted since the receiving engine last (re-)synchronized.

   If an authoritative SNMPv3 engine is ever unable to determine its
   latest engineBoots value, then it must set its engineBoots value to
   0xffffffff.

   Whenever the local value of engineBoots has the value 0xffffffff, it
   latches at that value and an authenticated message always causes an
   usecStatsNotInTimeWindows
   notInTimeWindow authentication failure.

   In order to reset an engine whose engineBoots value has reached the
   value 0xffffffff, manual intervention is required.  The engine must
   be physically visited and re-configured, either with a new
   snmpEngineID value, or with new secret values for the authentication
   and privacy protocols of all users known to that engine.

2.2.3.  Time Window

   The Time Window is a value that specifies the window of time in which
   a message generated on behalf of any user is valid.  This memo
   specifies that the same value of the Time Window, 150 seconds, is
   used for all users.

2.3.  Error Reporting

   While processing  Time Synchronization

   Time synchronization, required by a received communication, an SNMPv3 non-authoritative engine may
   determine that the message is unacceptable (see Section 3).  In
   this case, the appropriate counter from the snmpGroup [RFC1907] or
   usecStatsGroup object groups is incremented and an error indication
   is returned
   section 5.1.1) in order to proceed with authentic communications,
   has occurred when the calling module.

   If an SNMPv3 non-authoritative engine acting in the authoritative role makes such a
   determination has obtained local
   values of engineBoots and engineTime from the reportableFlag indicates that a report may be
   generated, then after incrementing the appropriate counter, it is
   required to generate a message containing a report PDU, with the
   same userName as in the received message, and to send it to the
   transport address which originated the received message.  For all
   report PDUs, except those generated due to incrementing the
   usecStatsNotInTimeWindows counter, the report PDU is unauthenticated.
   For those generated due to incrementing usecStatsNotInTimeWindows,
   the report PDU is authenticated only if the received message was
   authenticated.

   The reportableFlag in a message may only be set if the message
   contains a Get, GetNext, GetBulk, Set, Inform operation.  The
   reportableFlag should never be set for a message that contains a
   Response, SNMPv2-Trap or Report operation.

2.4.  Time Synchronization

   Time synchronization, required by a non-authoritative engine (see
   section 5.1.1) in order to proceed with authentic communications,
   has occurred when the non-authoritative engine has obtained local
   values of engineBoots and engineTime from the authoritative engine authoritative engine
   that are within the authoritative engine's time window.  To remain
   synchronized, the local values must remain within the authoritative
   engine's time window and thus must be kept loosely synchronized
   with the values stored at the authoritative engine.

   In addition to keeping a local version of engineBoots and engineTime,
   a non-authoritative engine must also keep one other local variable,
   latestReceivedEngineTime.  This value records the highest value of
   engineTime that was received by the non-authoritative engine from
   the authoritative engine and is used to eliminate the possibility
   of replaying messages that would prevent the non-authoritative
   engine's notion of the engineTime from advancing.

   Time synchronization occurs as part of the procedures of receiving
   a message (Section 3.2, step 7b). As such, no explicit time
   synchronization procedure is required by a non-authoritative engine.
   Note, that whenever the local value of snmpEngineID is changed
   (e.g., through discovery) or when a new secret is configured, secure communications are first
   established with this engine, the local values of engineBoots and
   latestReceivedEngineTime should be set to zero. This will cause
   the time synchronization to occur when the next authentic message
   is received.

2.5.

2.4.  SNMPv3 Messages Using this Model

   The syntax of an SNMPv3 message using this security model adheres
   to the message format defined in the SNMPng Architectural model SNMP Architecture document [SNMPng-ARCH].
   [SNMP-ARCH]. The securityParameters in the message are
   defined as an OCTET STRING. The format of that OCTET STRING for
   the User-based Security model is as follows:

      securityParameters ::=
          SEQUENCE {
              -- global parameters
              engineID
                  OCTET STRING (SIZE(12)),
              engineBoots
                  Unsigned32 (0..4294967295),
              engineTime
                  Unsigned32 (0..2147483647),
              userName
                  OCTET STRING (SIZE(1..16)),
              authParameters
                  OCTET STRING,
              privParameters
                  OCTET STRING,
          }
      END

   The authParameters are defined by the authentication protocol in
   use for the message (as defined by the authProtocol column in
   the user's entry in the usecUserTable).

   The privParameters are defined by the privacy protocol in
   use for the message (as defined by the privProtocol column in
   the user's entry in the usecUserTable).

2.6

2.5  Input and Output of the User-based Security Module

   This section describes the inputs and outputs that the User-based
   Security module expects and produces when the Message Processing
   and Control module (MPC) invokes the User-base Security module for
   services.

2.6.1

2.5.1 Input and Output when generating an SNMPv3 Message

   When the Message Processing and Control module (MPC) invokes the
   User-based Security module to secure an outgoing SNMPv3 message,
   it must pass as arguments:

   <globalData>
      this
   there are two possibilities:

   a) A new request is generated.  The abstract service interface is:

        generateRequestMsg(version, msgID, mms, msgFlags,
                           securityModel, securityParameters,
                           LoS, miId, engineID, scopedPDU)

   b) A response is generated.  The abtract service interface is:

        generateResponseMsg(version, msgID, mms, msgFlags,
                            securityModel, securityParameters,
                            scopedPDU, cachedSecurityDataReference)

   Where:

     version
      This is the global data in version number for the SNMP message. The important piece of
      information
      This data is not used by the Level USEC module.
      It is part of Security (LoS) from which the
      User-based Security module determines if globalData of the message needs to be
      protected from disclosure and if message.
     msgID
      This is the message needs msgID to be
      authenticated.

   <scopedPDU>
      this generated.
      This data is not used by the USEC module.
      It is part of the globalData of the message.
     mms
      This is the maximum message payload. The size.
      This data is opaque as far as not used by the
      User-based Security module is concerned.

   <securityCookie>
      this USEC module.
      It is an implementation specific handle that identifies an
      entry in part of the usecUserTable.

   <cachedSecurityData>
      cached security data to be used when securing an outgoing
      response. If no cachedSecurityData exists, then globalData of the
      securityCookie is used.

-- Editor's note:
      It message.
     msgFlags
      This is important that a response uses the same auth and priv
      protocols and secrets as field containing the incoming request. The security
      module msgFlags.
      This data is not supposed to look at the PDU-type.
      So it seems we need to cache used by the protocols and secrets either as USEC module.
      It is part of the securityCookie or it needs to globalData of the message.
      It should be cached as info consistent with the LoS that is attached to the msgID. We think we prefer the latter, because passed.
     securityModel
      This is the MPC also needs to cache certain info (like msgID, origin
      addressing info) about a message that may result securityModel in a response.
      So it seems we need one more in/output to use. Should be the MPC. We will use
      this cached USEC model.
      This data in the remainder of is not used by the text, assuming that
      for now this USEC module.
      It is part of the best way to do it.
-- End Editor's note

   Upon completion globalData of the process, message.
     securityParameters
      These are the User-based Security module security parameters. They will
   return either and error indication or the completed message with
   privacy and authentication applied if such was requested be filled in
      by the User-based Security module.
     LoS
      The Level of Security (LoS) flags passed as part of the <globalData>.

2.6.1 Input and Output when receiving an SNMPv3 Message
   When the Message Processing and Control module (MPC) invokes from which the User-based Security
      module determines if the message needs to verify proper security of an incoming
   SNMPv3 message, it must pass as arguments:

   <globalData>
      this is be protected from
      disclosure and if the global data in message needs to be authenticated.
     scopedPDU
      this is the message. message payload. The important piece of
      information data is the Level of Security (LoS) from which opaque as far as the
      User-based Security module determines if is concerned.
     miId
      this is the message has been
      protected from disclosure and if (security) model independent Identifier.
      Together with the message has engineID it identifies a row in the
      usecUserTable that is to be checked
      for authentication. Another piece of information used by for securing the
      User-based Security module is message.
     engineID
      the Maximum Message Size (MMS) in
      order engineID of the authoritative SNMP engine to calculate which the MMS that a scopedPDU can use in a
      potential response.

   <securityParameters>
      this
      request is the octet string that contains the User-based Security
      model specific to be sent.
     cachedSecurityDataReference
      A handle/reference to cached security parameters. See section 2.5 for details.

   <wholeMessage>
      this data to be used when
      securing an outgoing response. This is the complete message as it handle/reference
      that was received generated by the Message
      Processing and Control USEC module (MPC).  In the case of
      authentication, a digest needs to be calculated over when the complete
      message. incoming
      request was processed.

   Upon completion of the process, the User-based Security module will
   return
   returns either and error indication or these pieces of
   information/data:

   <scopedPDU-MMS>
      this is the maximum completed message size that a possible response PDU
      may use. The User-based
   with privacy and authentication applied if such was requested
   by the Level of Security module calculates (LoS) flags passed.

   The abstract service interface is:

      returnGeneratedMsg(wholeMsg, wholeMsgLen, statusCode)

   Where:
     wholeMsg
      this size such
      that there is always space available for any security parameters
      that need fully encoded and secured message ready to be added to sent on
      the response message.

   <groupName> wire.
     wholeMsgLen
      this is the group to which length of the user belongs. The User-base
      Security module retrieves encoded and secured message wholeMsg.
     statusCode
      this information from is the usecUserTable.

   <securityCookie>
      this indicator of whether the encoding and securing of
      the message was successful, and if not it is an implementation specific handle that identifies an
      entry in indication of
      the usecUserTable. It is to be used later when a response
      message must be secured.

   <cachedSecurityData>
      cached security data to be used problem.

2.5.2 Input and Output when securing a possible outgoing
      response to this request.

   <scopedPDU>
      this is the message payload. receiving an SNMPv3 Message

   The data is opaque as far as the
      User-based Security Message Processing and Control module is concerned.  But if the data was
      encrypted because privacy protection was in effect, then upon
      return from (MPC) invokes the
   User-based Security module the data will have
      been decrypted.

3.  Elements of Procedure

   This section describes the to verify proper security related procedures followed by of an incoming
   SNMPv3 engine when processing SNMPv3 messages according to the
   User-based Security model.

3.1.  Processing an Outgoing Message message. The abstract service interface is:

      processMsg(version, msgID, mms, msgFlags,
                 securityModel, securityParameters,
                 LoS, wholeMsg, wholeMsgLen)
   Where:

     version
      This section describes is the procedure followed version number for the SNMP message.
      This data is not used by an SNMPv3 engine
   whenever it generates a message containing a management operation
   (either a request, a response, a notification, or a report) on
   behalf the USEC module.
      It is part of a user, with a particular Level the globalData of Security (LoS).

   1)  - If any cachedSecurityData exists for this message, then
         information concerning the user message.
     msgID
      This is extracted from the
         cachedSecurityData.
       - Otherwise, based on msgID to be generated.
      This data is not used by the information in USEC module.
      It is part of the securityCookie,
         information concerning globalData of the user at message.
     mms
      This is the destination engineID maximum message size.
      This data is extracted from not used by the Security Configuration Datastore
         (SCD, usecUserTable).

   2)  If USEC module.
      It is part of the Level globalData of Security (LoS) specifies that the message message.
     msgFlags
      This is to
       be protected from disclosure, but the user does not support both
       an authentication and a privacy protocol then field containing the message cannot
       be sent.  An error indication msgFlags.
      This data is returned to not used by the calling USEC module.

   3)  If
      It is part of the Level globalData of Security (LoS) specifies that the message is to message.
      It should be authenticated, but consistent with the user does not support an authentication
       protocol, then LoS that is passed.
     securityModel
      This is the message cannot securityModel in use. Should be sent.  An error indication the USEC model.
      This data is returned to not used by the calling USEC module.

   4)  If
      It is part of the globalData of the message.
     securityParameters
      These are the security parameters. They will be filled in
      by the User-based Security module.
     LoS
      The Level of Security (LoS) specifies that from which the User-based Security
      module determines if the message is needs to be protected from disclosure, then the octet sequence
       representing
      disclosure and if the serialized scopedPDU is encrypted according message needs to
       the user's privacy protocol.  To do so a call be authenticated.
     wholeMsg
      this is made to the
       privacy module that implements the user's privacy protocol.
       Input passed to complete message as it was received by the privacy Message
      Processing and Control module is:

       <engineID> (MPC).
     wholeMsgLen
      this is the engineID length of the authoritative SNMPv3 engine wholeMsg as it will be
          included in received on the message.
       <userName> wire.

   Upon completion of the user on whose behalf process, the message User-based Security module
   returns a statusCode and in case of success authenticated and
   decrypted data. The abstract service interface is:

      returnMsg(miId, groupName, cachedSecurityDataReference,
                scopedPDUmms, scopedPDU, statusCode)

   Where:

     miId
      this is an Security Model-independent Identifier that identifies
      an entry in the usecUserTable. It is to be encrypted.
       <engineTime>
          the engineTime value as it will used later when a
      response message must be included in secured.
     groupName
      this is the message.
-- Editor's note:
            This has been added as an additional input so that group to which the
            privacy protocol can use it if it so wishes/needs. Turns
            out that user belongs. The User-based
      Security module retrieves this value is a good value for the IV for DES.
-- End Editor's note
       <cachedSecurityData> information from the possible usecUserTable.
     cachedSecurityDataReference
      cached security data if this is to be used when securing a possible outgoing
      response to an
          earlier request message.
       <scopedPDU>
          the data this request.  Will have to be encrypted.

       Upon completion released explicitly
      by the privacy module must return either an error
       indication or:

       <encryptedPDU> MPC or the encrypted scopedPDU (encoded as an octet string).
       <privParameters> application.
     scopedPDUmms
      this is the maximum message size that a possible response PDU
      may use. The privacy User-based Security module calculates this size such
      that there is always space available for any security parameters (encoded as an octet string)
      that need to be sent in added to the outgoing response message.

       If an error indication
     scopedPDU
      this is returned by the privacy module then the message cannot be sent and an error indication payload.  The data is returned to the
       calling module.
       If opaque as far as the privacy
      User-based Security module returns success, then the <privParameters>
       field is put into concerned.  But if the securityParameters and data was
      encrypted because privacy protection was in effect, then upon
      return from the <encryptedPDU>
       serves as User-based Security module the payload data will have
      been decrypted.
     statusCode
      this is an indicator of whether the message being prepared.

   5) was parsed,
      authenticated and possibly decrypted successfully. If
      it was not - it indicates what the Level problem was.

3.  Elements of Security (LoS) specifies that Procedure

   This section describes the message is not security related procedures followed by
   an SNMPv3 engine when processing SNMPv3 messages according to be protected from disclosure, then the NULL string is encoded
       as
   User-based Security model.

3.1.  Processing an octet string into Outgoing Message

   This section describes the <privParameters> field procedure followed by an SNMPv3 engine
   whenever it generates a message containing a management operation
   (either a request, a response, a notification, or a report) on
   behalf of a user, with a particular Level of Security (LoS).

   1)  - If any cachedSecurityDataReference is passed, then
         information concerning the
       securityParameters and user is extracted from the scopedPDU serves as
         cachedSecurityData. The cachedSecurityData can now be
         discarded.
       - Otherwise, based on the payload of miId, information concerning the message being prepared.

   6)  The user
         at the destination engineID is encoded as an octet string into extracted from the <engineID>
       field of Local
         (security) Configuration Datastore (LCD, usecUserTable).
         If information about the securityParameters.

   7) user is absent from the LCD,
         then an error indication (unknownSecurityIdentity) is
         returned to the calling module.

   2)  If the Level of Security (LoS) specifies that the message is to
       be authenticated, then the current values of engineBoots, and
       engineTime corresponding to engineID protected from disclosure, but the SCD are used.
       Otherwise, user does not support both
       an authentication and a zero value privacy protocol then the message cannot
       be sent.  An error indication (unsupportedLoS) is used for engineBoots and engineTime.
       The values are encoded as Unsigned32 into returned to
       the <engineBoots> and
       <engineTime> fields calling module.

   3)  If the Level of Security (LoS) specifies that the securityParameters.

   8)  The userName message is encoded as to
       be authenticated, but the user does not support an octet string into authentication
       protocol, then the <userName>
       field of message cannot be sent.  An error indication
       (unsupportedLoS) is returned to the securityParameters.

   9) calling module.

   4)  If the Level of Security (LoS) specifies that the message is to
       be authenticated, protected from disclosure, then the message octet sequence
       representing the serialized scopedPDU is authenticated encrypted according to
       the user's authentication privacy protocol.  To do so, so a call is made to the
       authentication
       privacy module that implements the user's authentication privacy protocol. Input passed to the authentication module
       The abstract service interface is:

       <engineID>
          the engineID of the authoritative SNMPv3 engine as it will be
          included in the message.
       <userName>
          the user on whose behalf the message is to be authenticated.

       <cachedSecurityData>
          the possible cached security data if this

           encryptMsg(cryptKey, scopedPDU)

         Where:

         cryptKey
           The user's usecUserPrivKey. This is a response to an
          earlier request message.
       <authParameters> the authParameters, to secret key
           that can be filled used by the authentication module.
       <wholeMessage>
          the message encryption algorithm.
         scopedPDU
           The data to be authenticated.

       Output expected from encrypted.

       Upon completion the authentication privacy module is returns:

           returnEncryptedMsg(encryptedPDU, privParameters, statusCode)

         encryptedPDU
           The encrypted scopedPDU (encoded as an error
       indication or octet string).
         privParameters
           The privacy parameters (encoded as an octet string) that
           need to be sent in the completed outgoing message.
         statusCode
           The indicator of whether the PDU was encrypted successfully
           and if not, it indicates what went wrong.

       If an error indication is returned by the authentication module, privacy module then
       the message cannot be sent and an the error indication is returned
       to the calling module.

   10)

       If the privacy module returns success, then the privParameters
       field is put into the securityParameters and the encryptedPDU
       serves as the payload of the message being prepared.

   5)  If the Level of Security (LoS) specifies that the message is not
       to be authenticated protected from disclosure, then the NULL string is encoded
       as an octet string into the <authParameters> privParameters field of the securityParameters.

   11) The completed
       securityParameters and the scopedPDU serves as the payload of
       the message being prepared.

   6)  The engineID is returned to the calling module.

3.2.  Processing encoded as an Incoming Message

   This section describes octet string into the procedure followed by an SNMPv3 engine
   whenever it receives a message containing a management operation
   on behalf <engineID>
       field of a user, with a particular the securityParameters.

   7)  If the Level of Security (LoS).

   1)  If (LoS) specifies that the received securityParameters message is not the serialization
       (according to
       be authenticated, then the conventions of [RFC1906]) current values of an OCTET STRING
       formatted according engineBoots, and
       engineTime corresponding to engineID from the securityParameters defined in section
       2.5, then the snmpInASNParseErrs counter [RFC1907] LCD are used.
       Otherwise, a zero value is
       incremented, used for engineBoots and an error indication is returned to the calling
       module.

   2) engineTime.
       The values of the security parameter fields are extracted from
       the securityParameters.

   3)  If the <engineID> field contained in the securityParameters is
       unknown then:

       - a manager that performs discovery may optionally create a new
         entry in its Security Configuration Database (SCD) and continue
         processing; or

       - the usecStatsUnknownEngineIDs counter is incremented, a report
         PDU is generated, and an error indication is returned to the
         calling module.

   4)  Information about the value of encoded as Unsigned32 into the <userName> engineBoots and <engineID>
       engineTime fields is extracted from the local Security Configuration
       Database (SCD, usecUserTable).  If no information is available
       for this user, then of the usecStatsUnknownUserNames counter is
       incremented, a report PDU securityParameters.

   8)  The userName is generated, and encoded as an error indication
       is returned to the calling module.

   5)  If the information about the user indicates that it does not
       support the Level of Security indicated by octet string into the <LoS> userName
       field in
       the globalData, then the usecStatsUnsupportedLoS counter is
       incremented, a report PDU is generated, and an error indication
       is returned to of the calling module.

   6) securityParameters.

   9)  If the Lever Level of Security (LoS) specifies that the message is to
       be authenticated, then the message is authenticated according to the
       user's authentication protocol. To do so, a call is made to the
       authentication module that implements the user's authentication
       protocol.  Input passed to the authentication
       module  The abstract service interface is:

       <engineID>
          the engineID of the authoritative SNMPv3 engine as it was
          included in the message.
       <userName>
          the user on whose behalf the message

            authMsg(authKey, wholeMsg)

          authKey
            The user's usecUserAuthKey. This is to the secret key
            that can be authenticated.
       <authParameters> used by the authParameters.
       <wholeMessage> authentication algorithm.
          wholeMsg
            the message to be authenticated.

       If the message is not authentic according to

       Upon completion the authentication
       protocol module (i.e. it returns returns:

            returnAuthMsg(wholeMsg, statusCode)

          wholeMsg
            Same as in input, but with authParameters properly filled.
          statusCode
            The indicator of whether the message was successfully
            processed by the authentication module.

       If an error indication), indication is returned by the authentication module,
       then an the message cannot be sent and the error indication is
       returned to the calling module.

       Otherwise

   10) If the authentication module must return these pieces Level of
       information/data:

       <cachedSecurityData>
          the cached security data so Security (LoS) specifies that it can be used later when
          a response to a request the message must be secured.
-- Editor's note:
            If we are is not supposed
       to look at the PDU type, be authenticated then it
            seems we must always cache the security data. But that then
            makes it problematic NULL string is encoded as to who gets rid of the cache and
            when..... or do we consider that an implementation issue?
-- End Editor's note

   7)  If octet
       string into the <LoS> authParameters field indicates an authenticated message, then
       the local values of engineBoots and engineTime corresponding the securityParameters.

   11) The completed message is returned to the value of calling module with
       the <engineID> field are extracted from statusCode set to success.

3.2.  Processing an Incoming Message

   This section describes the procedure followed by an SNMPv3 engine
   whenever it receives a message containing a management operation
   on behalf of a user, with a particular Level of Security Configuration Database (SCD).

       a) (LoS).

   1)  If the <engineID> value received securityParameters is not the same as serialization
       (according to the engineID conventions of
          the processing SNMPv3 engine (meaning that this is the
          authoritative engine), then if any [RFC1906]) of an OCTET STRING
       formated according to the following
          conditions is true, securityParameters defined in section
       2.4, then the message snmpInASNParseErrs counter [RFC1907] is considered
       incremented, and an error indication (ASNParseError) is returned
       to be
          outside of the Time Window:

           - the local value calling module.

   2)  The values of engineBoots is 0xffffffff;

           - the <engineBoots> field differs security parameter fields are extracted from
       the local value of
             engineBoots; or, securityParameters.

   3)  If the engineID field contained in the securityParameters is
       unknown then:

       - a manager that performs discovery may optionally create a
         new entry in its Local (security) Configuration Database (LCD)
         and continue processing; or

       - an error indication (unknownEngineID) is returned to the
         calling module.

   4)  Information about the value of the <engineTime> field differs userName and engineID
       fields is extracted from the local
             notion Local (security) Configuration
       Database (LCD, usecUserTable).  If no information is
       available for this user, then an error indication
       (unknownSecurityIdentity) is returned to the calling module.

   5)  If the information about the user indicates that it does not
       support the Level of engineTime Security indicated by more than +/- 150 seconds. the LoS parameter,
       then and an error indication (unsupportedLoS) is returned to
       the calling module.

   6)  If the Level of Security (LoS) specifies that the message is considered to
       be outside of the Time Window authenticated, then the usecStatsNotInTimeWindows counter message is incremented, an authenticated report PDU according to
       the user's authentication protocol.  To do so, a call is generated (see section 2.3), and made to
       the authentication module that implements the user's
       authentication protocol. The abstract service interface is:

           authIncomingMsg(authKey, authParameters, wholeMsg)

         authKey
           The user's (secret) usecUserAuthKey
         authParameters
           the authParameters from the incoming message.
         wholeMsg
           the message to be authenticated.

       The authentication module returns:

           returnAuthIncomingMsg(wholeMsg, statusCode)

       If the message is not authentic according to the authentication
       protocol module (i.e. it returns an error indication), then the
       error indication is returned to the calling module.

       b)

       Otherwise, the authenticated wholeMsg is used for further
       processing.

   7)  If the <engineID> LoS field indicates an authenticated message, then
       the local values of engineBoots and engineTime corresponding to
       the value of the engineID field are extracted from the
       Local (security) Configuration Database (LCD).

       a) If the engineID value is not the same as the engineID snmpEngineID of
          the processing SNMPv3 engine (meaning that this engine is not the
          authoritative engine), then:

          - then if all any of the following
          conditions are true: is true, then the message is considered to be
          outside of the Time Window:

           - if the <LoS> field indicates that privacy local value of engineBoots is not in use; 0xffffffff;

           - the SNMPv2 operation type determined engineBoots field differs from the ASN.1 tag local value associated with of
             engineBoots; or,

           - the PDU's component value of the engineTime field differs from the local
             notion of engineTime by more than +/- 150 seconds.

          If the message is a Report;

-- Editor's note:
   So it turns out we do need considered to look at be outside of the PDU data
   Mmmm... this Time Window
          then an error indication (notInTimeWindow) is against our own rules returned to
          the calling module.

       b) If the engineID value is not the same as the snmpEngineID of cohesion and encapsulation
-- End Editor's note
          the processing SNMPv3 engine (meaning that this engine is not
          the authoritative engine), then:

          - if at least one of the Report was generated due to a
              usecStatsNotInTimeWindows error condition; and, following conditions is true:

            - the <engineBoots> engineBoots field is greater than the local value
              of
              engineBoots, or engineBoots; or,

            - the <engineBoots> engineBoots field is equal to the local value of
              engineBoots and the <engineTime> engineTime field is greater than
              the value of latestReceivedEngineTime,

            then the SCD LCD entry corresponding to the value of the
            <engineID>
            engineID field is updated, by setting the local value of
            engineBoots from the <engineBoots> engineBoots field, the local value
            latestReceivedEngineTime from the <engineTime> engineTime field, and
            the local value of engineTime from the <engineTime> engineTime field.

          - if any of the following conditions is true, then the message
            is considered to be outside of the Time Window:

            - the local value of engineBoots is 0xffffffff;

            - the <engineBoots> engineBoots field is less than the local value of
              engineBoots; or,

            - the <engineBoots> engineBoots field is equal to the local value of
              engineBoots and the <engineTime> engineTime field is more than 150
              seconds less than the local notion of engineTime.

            If the message is considered to be outside of the Time
            Window then the usecStatsNotInTimeWindows counter is
            incremented, and an error indication (notInTimeWindow) is
            returned to the calling module;
            however, time synchronization procedures may be invoked.
            Note that this procedure allows for <engineBoots> engineBoots in the
            message to be greater than the local value of engineBoots
            to allow for received messages to be accepted as authentic
            when received from an authoritative SNMPv3 engine that
            has re-booted since the receiving SNMPv3 engine last re-synchronized.

          - if at least one of the following conditions is true:

            -
            (re-)synchronized.

   8)  If the <engineBoots> LoS field is greater than indicates that the local value of
              engineBoots; or,

            - message was protected from
       disclosure, then the <engineBoots> field octet sequence representing the scopedPDU
       is equal decrypted according to the local value of
              engineBoots and user's privacy protocol to obtain
       a serialized scopedPDUs value.  Otherwise the <engineTime> field data component is greater than
       assumed to directly contain the
              value of latestReceivedEngineTime,

            then scopedPDUs value. To do the SCD entry corresponding to the value of the
            <engineID> field is updated, by setting the local value of
            engineBoots from the <engineBoots> field, the local value
            latestReceivedEngineTime from the <engineTime> field, and
            the local value of engineTime from the <engineTime> field.

   8)  If the <LoS> field indicates that the message was protected from
       disclosure, then the octet sequence representing the <scopedPDU>
       is decrypted according to the user's privacy protocol to obtain
       a serialized scopedPDUs value.  Otherwise the data component is
       assumed to directly contain the scopedPDUs value. To do the
       decryption, a call is made
       decryption, a call is made to the privacy module that implements
       the user's privacy protocol.  Input passed to the privacy module  The abstract service interface is:

       <snmpEngineID>
          the engineID of the authoritative SNMPv3 engine as it was
          included in the message.
       <userName>
          the user on whose behalf the message is to be decrypted.
       <engineTime>

           decryptMsg(cryptKey, privParameters, encryptedPDU)

         cryptKey
           The user's secret usecUserPrivKey
         privParameters
           The privParameters field from the engineTime value as it was included in securityParameters from
           the incoming message.
       <encryptedPDU>
         encryptedPDU
           the data to be decrypted
       Output expected from the

       The privacy module is an error code or:

       <cachedSecurityData>
          the cached security data so that it can be used later when
       <scopedPDU>
          the returns:

           returnDecryptedMsg(scopedPDU, statusCode)

         scopedPDU
           The decrypted scopedPDU.
         statusCode
           The indicator whether the message was successfully decrypted.

       If an error code indication is returned by the privacy module, then an
       the error indication is returned to the calling module.

   9)  The scopedPDU-MMS is calculated.

   10) The groupName is retrieved from the usecUserTable. usecUserTable

   11) The <securityCookie> miId is retrieved from the usecUserTable

   12) A return The securityData is made to the calling module, passing these values:

       <scopedPDU-MMS>
          the maximum message size cached, so that a possible response may use.

       <groupName>
          the name of the group that the user, on whose behalf the
          message was sent, belongs to.

       <securityCookie> to
       this is an implementation specific handle that identifies an
          entry in message can use the usecUserTable. It is same authentication and privacy
       secrets.  Information to be used later when a
          response message must be secured.

       <cachedSecurityData> saved/cached is as follows:

          usecUserName,
          usecUserAuthProto, usecUserAuthKey,
          usecUserPrivProto, usecUserPrivKey

-- Editor's note:
   If we assume SNMPv3, then we could check the cached security data so that reportableFlag and if
   it can be used later when

       <scopedPDU> is not set, then we do not need to cache any security data
   because then there is no response possible. Do we want to do that?
-- End Editor's note.

   13) The statusCode is set to success and a return is made to the scopedPDU (message payload)
       calling module according to this abstract service interface:

          returnMsg(miId, groupName, cachedSecurityDataReference,
                    scopedPDUmms, scopedPDU, statusCode)

4.  Discovery

   This security model requires that a discovery process obtain obtains
   sufficient information about other SNMPv3 entities SNMP engines in order to
   communicate with them.  Discovery requires the SNMPv3 SNMP manager to
   learn the engine's snmpEngineID value before communication may
   proceed.  This may be accomplished by formulating a get-request
   communication with the LoS set to noAuth/noPriv, the userName set
   to "public", the snmpEngineID set to all zeros (binary), and the
   varBindList left empty.  The response to this message will be a
   report PDU that contains the snmpEngineID within the
   <securityParameters>
   securityParameters field (and containing the
   usecStatsUnknownEngineIDs snmpUnknownEngineIDs
   counter in the varBindList).
   If authenticated communication is required then the discovery
   process may invoke the procedure described in Section 2.4 2.3 to
   synchronize the clocks. timers.

5.  Definitions

SNMPv3-USEC-MIB

SNMP-USEC-MIB DEFINITIONS ::= BEGIN

IMPORTS
    Counter32, Unsigned32,
    MODULE-IDENTITY, OBJECT-TYPE, snmpModules  FROM SNMPv2-SMI
    TEXTUAL-CONVENTION, TestAndIncr,
    RowStatus, AutonomousType, StorageType,
    TDomain, TAddress StorageType                     FROM SNMPv2-TC
    MODULE-COMPLIANCE, OBJECT-GROUP            FROM SNMPv2-CONF,
    SnmpV3GroupName, SnmpV3ContextName,
    SnmpV3LoS, SnmpV3EngineID,
    SnmpV3SecurityModel, SnmpV3SecurityCookie
    SnmpAdminString, SnmpLoS, SnmpEngineID,
    SnmpSecurityModel,
    imfAuthMD5Protocol, imfNoPrivProtocol      FROM SNMPv3-MIB;

-- Editor's note:
            Not sure if the above are all in SNMPv3-MIB, need to see
            how the complete MPC document will look like.
-- End Editor's note

snmpV3UsecMIB IMF-MIB;

snmpUsecMIB MODULE-IDENTITY
    LAST-UPDATED "9705090000Z" "9706180000Z"     -- 09 May 18 June 1997, midnight
    ORGANIZATION "SNMPv3 Working Group"
    CONTACT-INFO "WG-email:   snmpv3@tis.com
                  Subscribe:  majordomo@tis.com
                              In msg body:  subscribe snmpv3

                  Chair:      Russ Mundy
                              Trutsed
                              Trusted Information Systems
                  postal:     3060 Washington Rd
                              Glenwood MD 21738
                  email:      mundy@tis.com
                  phone:      301-854-6889

                  Co-editor   Uri Blumenthal
                              IBM T. J. Watson Research
                  postal:     30 Saw Mill River Pkwy,
                              Hawthorne, NY 10532
                              USA
                  email:      uri@watson.ibm.com
                  phone:      +1.914.784.7964

                  Co-editor:  Bert Wijnen
                              IBM T. J. Watson Research
                  postal:     Schagen 33
                              3461 GL Linschoten
                              Netherlands
                  email:      wijnen@vnet.ibm.com
                  phone:      +31-348-412-498      +31-348-432-794
                 "

    DESCRIPTION  "The management information definitions for the
                  SNMPv3 User-based Security model.
                 "
    ::= { snmpModules xx 99 }  -- to be assigned

-- Administrative assignments ****************************************

snmpV3UsecAdmin

snmpUsecAdmin           OBJECT IDENTIFIER ::= { snmpV3UsecMIB snmpUsecMIB 1 }
snmpV3UsecMIBObjects
snmpUsecMIBObjects      OBJECT IDENTIFIER ::= { snmpV3UsecMIB snmpUsecMIB 2 }
snmpV3UsecMIBConformance
snmpUsecMIBConformance  OBJECT IDENTIFIER ::= { snmpV3UsecMIB snmpUsecMIB 3 }

usecAuthProtocols    OBJECT IDENTIFIER ::= { snmpV3UsecAdmin 1 }

-- no Authentication Protocol
usecNoAuthProtocol   OBJECT IDENTIFIER Textual Conventions ***********************************************

UserName ::= { usecAuthProtocols 1 }

--     TEXTUAL-CONVENTION
    STATUS       current
    DESCRIPTION "A string representing the Digest Authentication Protocol
usecMD5AuthProtocol  OBJECT IDENTIFIER ::= { usecAuthProtocols 2 }

-- Privacy Protocols
usecPrivProtocols    OBJECT IDENTIFIER ::= { usecAdmin 2 }

-- no Privacy Protocol
usecNoPrivProtocol   OBJECT IDENTIFIER ::= { usecPrivProtocols 1 }

-- name of a user for use in
                 accordance with the Symmetric Encryption Protocol
usecDESPrivProtocol  OBJECT IDENTIFIER ::= { usecPrivProtocols 2 } SNMP User-based Security model.
                "
    SYNTAX       SnmpAdminString (SIZE(1..16))

-- Editor's note:
            We picked these up from earlier MIBs.
            It all seems a bit overdone though. If a user has no auth
            or priv protocol, we could just put
-- A real issue is whether the NULL OID  { 0 0 } fact that MD5 is used in the usecUserPrivProtocol or usecUserAuthProtocol column.
            There also seems no need to split between auth and priv
            protocols. How about the following (simpler) scheme:

    usecProtocols        OBJECT IDENTIFIER ::= { snmpV3UsecAdmin 1 }
    -- the Digest Authentication Protocol
    usecMD5AuthProtocol  OBJECT IDENTIFIER ::= { usecProtocols 1 }
-- the Symmetric Encryption Protocol
    usecDESPrivProtocol  OBJECT IDENTIFIER ::= { usecProtocols 2 } TC is OK. It might be better to use 3DES for 3DES and IDEA for IDEA.
-- End Editor's note

-- Each engine has authoritative values for itself *******************

snmpEngine      OBJECT IDENTIFIER ::= { snmpV3UsecMIBObjects 1 }

snmpEngineID     OBJECT-TYPE
    SYNTAX       SnmpEngineID
    MAX-ACCESS   read-only
    STATUS       current
    DESCRIPTION "The SNMP engine's administratively-unique identifier."

KeyChange ::= { snmpEngine 1 }

snmpEngineBoots  OBJECT-TYPE
    SYNTAX       Unsigned32
    MAX-ACCESS   read-only    TEXTUAL-CONVENTION
    STATUS       current
    DESCRIPTION "The number
         "Every definition of times that an object with this syntax must identify
          a protocol, P, and a secret key, K.  The object's value is a
          manager-generated, partially-random value which, when
          modified, causes the engine has re-initialized
                 itself since its initial configuration.
                "
    ::= { snmpEngine 2 }

snmpEngineTime   OBJECT-TYPE
    SYNTAX       Unsigned32 (0..2147483647)
    UNITS       "seconds"
    MAX-ACCESS   read-only
    STATUS       current
    DESCRIPTION "The number value of seconds since the engine last
                 incremented the snmpEngineBoots object.
                "
    ::= { snmpEngine 3 }

-- Statistics for the User-based Security model ***********************

usecStats       OBJECT IDENTIFIER ::= { snmpV3UsecMIBObjects 2 }

usecStatsUnsupportedLoS OBJECT-TYPE
    SYNTAX       Counter32
    MAX-ACCESS   read-only
    STATUS       current
    DESCRIPTION "The total number secret key, K, to be
          modified via a one-way function.

          The value of packets received by an instance of this object is the SNMPv3
                 engine which were dropped because they requested concatenation
          of two components: a
                 Level 'random' component and a 'delta'
          component.  The lengths of Security that was unknown to the engine or
                 otherwise unavailable.
                "
    ::= { usecStats 1 }

usecStatsNotInTimeWindows OBJECT-TYPE
    SYNTAX       Counter32
    MAX-ACCESS   read-only
    STATUS       current
    DESCRIPTION "The total number of packets received random and delta components are
          given by the SNMPv3
                 engine which were dropped because they appeared
                 outside corresponding value of the engine's window.
                "
    ::= { usecStats 2 }

usecStatsUnknownUserNames OBJECT-TYPE
    SYNTAX       Counter32
    MAX-ACCESS   read-only
    STATUS       current
    DESCRIPTION "The total number protocol, P; if P
          requires K to be a fixed length, the length of packets received by both the SNMPv3
                 engine which were dropped because they referenced a
                 user random
          and delta components is that was not known to fixed length; if P allows the engine.
                "
    ::= { usecStats 3 }

usecStatsUnknownEngineIDs OBJECT-TYPE
    SYNTAX       Counter32
    MAX-ACCESS   read-only
    STATUS       current
    DESCRIPTION "The total number
          length of packets received by K to be variable up to a particular maximum length,
          the SNMPv3
                 engine which were dropped because they referenced an
                 engineID length of the random component is that was not known maximum length and
          the length of the delta component is any length less than or
          equal to that maximum length.  For example,
          imfAuthMD5Protocol requires K to be a fixed length of 16
          octets.  Other protocols may define other sizes, as deemed
          appropriate.

          When an instance of this object is modified to have a new
          value by the engine.
                "
    ::= { usecStats 4 }

-- Textual Conventions ***********************************************

UserName ::= TEXTUAL-CONVENTION
    STATUS       current
    DESCRIPTION "An octet string representing management protocol, the name agent generates a new
          value of K as follows:

           - a user for
                 use in accordance with temporary variable is initialized to the SNMPv3 User-based Security
                 model.
                "
    SYNTAX       OCTET STRING (SIZE(1..16))

-- The valid users for existing value
             of K;
           - if the User-based Security model ******************

usecUser         OBJECT IDENTIFIER ::= { snmpV3UsecMIBObjects 3 }

usecUserTable    OBJECT-TYPE
    SYNTAX       SEQUENCE OF UsecUserEntry
    MAX-ACCESS   not-accessible
    STATUS       current
    DESCRIPTION "The table length of users configured in the SNMPv3 entity's
                 security configuration datastore (SCD)."
    ::= { usecUser 1 }

usecUserEntry    OBJECT-TYPE
    SYNTAX       UsecUserEntry
    MAX-ACCESS   not-accessible
    STATUS       current
    DESCRIPTION "A user configured in delta component is greater than 16
             bytes, then:
              - the SNMPv3 entity's security
                 configuration datastore (SCD) for random component is appended to the User-based
                 Security model.
                "
    INDEX       { usecUserEngineID,
                  IMPLIED usecUserName
                }
    ::= { usecUserTable 1 }

UsecUserEntry ::= SEQUENCE {
    usecUserEngineID         SnmpEngineID,
    usecUserName             UserName,
    usecUserGroupName        SnmpV3GroupName,
    usecUserAuthProtocol     OBJECT IDENTIFIER,
    usecUserPrivProtocol     OBJECT IDENTIFIER,
    usecUserStorageType      StorageType,
    usecUserSecurityCookie   SnmpV3SecurityCookie,
    usecUserStatus           RowStatus
}

usecUserEngineID OBJECT-TYPE
    SYNTAX       SnmpEngineID
    MAX-ACCESS   not-accessible
    STATUS       current
    DESCRIPTION "An SNMPv3 engine's administratively-unique identifier.

                 In a simple agent, this value of the
                temporary variable, and the result is always that agent's
                 own snmpEngineID value.

                 This value can also take input to the MD5
                hash algorithm to produce a digest value, and the
                temporary variable is set to this digest value;
              - the value of the snmpEngineID
                 of a remote SNMP engine temporary variable is XOR-ed with which this user can
                 communicate.
                "
    ::= { usecUserEntry 1 }

usecUserName     OBJECT-TYPE
    SYNTAX       UserName
    MAX-ACCESS   not-accessible
    STATUS       current
    DESCRIPTION "An octet string representing the name
                first (next) 16-bytes of the user."
    ::= { usecUserEntry 2 }

usecUserGroupName OBJECT-TYPE
    SYNTAX       SnmpV3GroupName
    MAX-ACCESS   read-write
    STATUS       current
    DESCRIPTION "An octet string representing the group delta component to which produce
                the
                 user belongs.  A group name first (next) 16-bytes of zero length indicates
                 that the user is not [perhaps yet] a member new value of any
                 group, possibly because K.
              - the entry has not yet been
                 completely configured.  Users which above two steps are not a part repeated until the unused
                portion of any group are effectively disabled the delta component is 16 bytes or less,
           - the random component is appended to perform any
                 SNMP operations.
                "
    DEFVAL      { ''H } -- the empty string
    ::= { usecUserEntry 3 }

usecUserAuthProtocol OBJECT-TYPE
    SYNTAX       OBJECT IDENTIFIER
    MAX-ACCESS   read-create
    STATUS       current
    DESCRIPTION "An indication of whether messages sent on behalf value of
                 this user to/from the engine identified by
                 usecUserEngineID, can be authenticated,
             temporary variable, and if so, the type of authentication protocol which result is used.

                 An instance of this object is created concurrently
                 with input to the creation of any other object instance for MD5
             hash algorithm to produce a digest value;
           - this digest value, truncated if necessary to be the same user (i.e.,
             length as part of the processing unused portion of the set operation which creates delta component, is
             XOR-ed with the first object
                 instance in unused portion of the same conceptual row).  Once created, delta component to
             produce the (final portion of the) new value of an instance K.

             i.e.,

                iterations = (lenOfDelta - 1)/16; /* integer division */
                temp = keyOld;
                for (i = 0; i < iterations; i++) {
                   temp = MD5 (temp || random);
                   keyNew[i*16 .. (i*16)+15] =
                          temp XOR delta[i*16 .. (i*16)+15];
                }
                temp = MD5 (temp || random);
                keyNew[i*16 .. lenOfDelta-1] =
                       temp XOR delta[i*16 .. lenOfDelta-1];

          The value of this an object can not be
                 changed.
                "
    DEFVAL with this syntax, whenever it is
          retrieved by the management protocol, is always the zero-
          length string."
    SYNTAX      OCTET STRING

-- *******************************************************************

-- The valid users for the User-based Security model ******************

usecUser         OBJECT IDENTIFIER ::= { usecMD5AuthProtocol snmpUsecMIBObjects 1 }

usecUserTable    OBJECT-TYPE
    SYNTAX       SEQUENCE OF UsecUserEntry
    MAX-ACCESS   not-accessible
    STATUS       current
    DESCRIPTION "The table of users configured in the SNMP engine's
                 Local (security) Configuration Datastore (LCD)."
    ::= { usecUserEntry 4 usecUser 1 }

usecUserPrivProtocol

usecUserEntry    OBJECT-TYPE
    SYNTAX       OBJECT IDENTIFIER       UsecUserEntry
    MAX-ACCESS   read-create   not-accessible
    STATUS       current
    DESCRIPTION "An indication of whether messages sent on behalf of
                 this "A user to/from the engine identified by
                 usecUserEngineID, can be protected from disclosure,
                 and if so, configured in the type of privacy protocol which is used.

                 An instance of this object is created concurrently
                 with SNMP engine's Local
                 (security) Configuration Datastore (LCD) for
                 the creation of any other object instance for User-based Security model.
                "
    INDEX       { usecUserEngineID,
                  IMPLIED usecUserName
                }
    ::= { usecUserTable 1 }

UsecUserEntry ::= SEQUENCE {
    usecUserEngineID         SnmpEngineID,
    usecUserName             UserName,
    usecUserMiId             SnmpAdminString,
    usecUserGroupName        SnmpAdminString,
    usecUserCloneFrom        RowPointer,
    usecUserAuthProtocol     OBJECT IDENTIFIER,
    usecUserAuthKeyChange    KeyChange,
--  usecUserAuthKey          OCTET STRING, not visible
    usecUserAuthPublic       OCTET STRING,
    usecUserPrivProtocol     OBJECT IDENTIFIER,
    usecUserPrivKeyChange    KeyChange,
--  usecUserPrivKey          OCTET STRING, not visible
    usecUserPrivPublic       OCTET STRING,
    usecUserStorageType      StorageType,
    usecUserStatus           RowStatus
}

usecUserEngineID OBJECT-TYPE
    SYNTAX       SnmpEngineID
    MAX-ACCESS   not-accessible
    STATUS       current
    DESCRIPTION "An SNMP engine's administratively-unique identifier.

                 In a simple agent, this value is always that agent's
                 own snmpEngineID value.

                 This value can also take the same user (i.e., as part value of the processing snmpEngineID
                 of
                 the set operation a remote SNMP engine with which creates the first object
                 instance in the same conceptual row).  Once created,
                 the value of an instance of this object user can not be
                 changed.
                 communicate.
                "
    DEFVAL      { usecNoPrivProtocol }
    ::= { usecUserEntry 5 1 }

usecUserStorageType

usecUserName     OBJECT-TYPE
    SYNTAX       StorageType       UserName
    MAX-ACCESS   read-create   not-accessible
    STATUS       current
    DESCRIPTION "The storage type for this conceptual row."
    DEFVAL      { nonVolatile } "A string representing the name of the user.  This is
                 the (User-based security) model dependent identity.
                "
    ::= { usecUserEntry 7 2 }

usecUserSecurityCookie

usecUserMiId     OBJECT-TYPE
    SYNTAX       SnmpV3SecurityCookie       SnmpAdminString
    MAX-ACCESS   read-only
    STATUS       current
    DESCRIPTION "An implementation specific handle that identifies "A string representing the (security) model independent
                 identity for this user.

                 The default mapping for the User-based Security model and this entry in
                 is that the
                 usecUserTable. miId is the same as the userName.
                "
    DEFVAL      { nonVolatile }
    ::= { usecUserEntry 7 3 }

usecUserStatus

usecUserGroupName OBJECT-TYPE
    SYNTAX       RowStatus       SnmpAdminString
    MAX-ACCESS   read-create   read-write
    STATUS       current
    DESCRIPTION "The status of this conceptual row.  Until instances
                 of all corresponding columns are appropriately
                 configured, "A string representing the value of group to which the corresponding instance user
                 belongs.  A group name of zero length indicates
                 that the usecUserStatus column user is 'notReady'.

                 For those columnar objects which permit write-access,
                 their value in an existing conceptual row can be
                 changed irrespective not [perhaps yet] a member of any
                 group, possibly because the value entry has not yet been
                 completely configured.  Users which are not a part
                 of usecUserStatus
                 for that row. any group are effectively disabled to perform any
                 SNMP operations.
                "
    ::=
    DEFVAL      { usecUserEntry 8 ''H } -- Conformance Information *******************************************

snmpV3UsecMIBCompliances
                 OBJECT IDENTIFIER ::= { snmpV3UsecMIBConformance 1 }
snmpV3UsecMIBGroups
                 OBJECT IDENTIFIER the empty string
    ::= { snmpV3UsecMIBConformance 2 usecUserEntry 4 }

-- Compliance statements

snmpV3UsecMIBCompliance MODULE-COMPLIANCE

usecUserCloneFrom OBJECT-TYPE
    SYNTAX       RowPointer
    MAX-ACCESS   read-create
    STATUS       current
    DESCRIPTION "The compliance statement for SNMPv3 engines which
                 implement the SNMPv3 USEC MIB.
                "

    MODULE       -- "A pointer to another conceptual row in this module
        MANDATORY-GROUPS { snmpV3UsecMIBBasicGroup }

        OBJECT           usecUserGroupName
        MIN-ACCESS       read-only
        DESCRIPTION     "Write access
                 usecUserTable.  The user in this other conceptual row
                 is not required."

        OBJECT           usecUserAuthProtocol
        MIN-ACCESS       read-only
        DESCRIPTION     "Write access called the clone-from user.

                 When a new user is not required."

        OBJECT           usecUserPrivProtocol
        MIN-ACCESS       read-only
        DESCRIPTION     "Write access created (i.e., a new conceptual row
                 is not required."
    ::= { snmpV3UsecMIBCompliances 1 }

-- Units of compliance

snmpV3UsecMIBBasicGroup OBJECT-GROUP
    OBJECTS     { snmpEngineID,
                  snmpEngineBoots,
                  snmpEngineTime,
                  usecStatsUnsupportedLoS,
                  usecStatsNotInTimeWindows,
                  usecStatsUnknownUserNames,
                  usecStatsUnknownEngineIDs,
                  usecUserGroupName,
                  usecUserAuthProtocol,
                  usecUserPrivProtocol,
                  usecUserSecurityCookie,
                  usecUserStorageType,
                  usecUserStatus
                }
    STATUS       current
    DESCRIPTION "A collection of objects providing for configuration
                 of an SNMPv3 entity which implements the SNMPv3
                 User-based Security model.
                "
    ::= { snmpV3UsecMIBGroups 1 }

END

6.  MD5 Authentication Protocol

   This section describes instantiated in this table), the Keyed-MD5 authentication protocol.
   This protocol is
                 parameters of the new user are cloned from its
                 clone-from user.

                 The first authentication protocol defined for
   the User-based Security model.
   Over time, other authentication protocols may be defined either
   as a replacement time an instance of this protocol object is set by a
                 management operation (either at or in addition to this protocol.

6.1  Mechanisms

   - In support of data integrity, a message digest algorithm is
     required.  A digest after its
                 instantiation), the cloning process is calculated over invoked.
                 Subsequent writes are successful but invoke no action
                 to be taken by the agent.
                 The cloning process fails with an appropriate portion
     of 'inconsistentName'
                 error if the conceptual row representing the
                 clone-from user is not in an SNMPv3 message and included as part of active state when the message sent
     to
                 cloning process is invoked.

                 Cloning also causes the recipient.

   - In support initial values of data origin the secret
                 authentication key and data integrity, a the secret value is both inserted into, and appended to, encryption key of
                 the SNMPv3
     message prior new user to computing the digest; the inserted value is
     overwritten prior be set to transmission, and the appended same value is not
     transmitted.  The as the
                 corresponding secret value of the clone-from user.

                 When this object is shared by all SNMPv3 engines
     authorized to originate read, the zero length string is
                 returned.
                "
    ::= { usecUserEntry 5 }

usecUserAuthProtocol OBJECT-TYPE
    SYNTAX       OBJECT IDENTIFIER
    MAX-ACCESS   read-create
    STATUS       current
    DESCRIPTION "An indication of whether messages sent on behalf of
                 this user to/from the appropriate
     user.

   - In order to not expose SNMP engine identified by
                 usecUserEngineID, can be authenticated, and if so,
                 the shared secrets (keys) at all SNMPv3
     engines in case one type of the engines authentication protocol which is compromised, such secrets
     (keys) are localized for each authoritative SNMPv3 engine, see
     [Localized-Key].

6.1.1.  Digest Authentication Protocol

   The Digest Authentication Protocol defined in used.

                 An instance of this memo provides for:

   - verifying object is created concurrently
                 with the integrity creation of a received message (i.e., the message
     received is any other object instance for
                 the message sent).

     The integrity same user (i.e., as part of the message is protected by computing a digest
     over an appropriate portion processing of a message.  The digest is computed
     by
                 the originator of set operation which creates the message, transmitted with first object
                 instance in the message, and
     verified by same conceptual row).  Once created,
                 the recipient value of an instance of this object can not be
                 changed.
                "
    DEFVAL      { imfAuthMD5Protocol }
    ::= { usecUserEntry 6 }

usecUserAuthKeyChange OBJECT-TYPE
    SYNTAX       KeyChange  -- typically (SIZE (0..32))
    MAX-ACCESS   read-create
    STATUS       current
    DESCRIPTION "An object, which when modified, causes the message.

   - verifying the user on whose behalf the message was generated.

     A secret value known only to SNMPv3 engines authorized to generate
                 authentication key used for messages sent on behalf
                 of a this user is both inserted into, and appended
     to, to/from the message prior SNMP engine identified by
                 usecUserEngineID, to be modified via a one-way
                 function.

                 The associated protocol is the digest computation.  Thus, usecUserAuthProtocol.
                 The associated secret key is the
     verification user's secret
                 authentication key (usecUserAuthKey).

                 When creating a new user, it is an 'inconsistentName'
                 error for a set operation to refer to this object
                 unless it is previously or concurrently initialized
                 through a set operation on the corresponding value
                 of usecUserCloneFrom.
                "
    DEFVAL      { ''H }    -- the user empty string
    ::= { usecUserEntry 7 }

usecUserAuthPublic    OBJECT-TYPE
    SYNTAX       OCTET STRING -- for MD5 (SIZE(0..32))
    MAX-ACCESS   read-create
    STATUS       current
    DESCRIPTION "A publicly-readable value which is implicit with the verification written as part
                 of the
     digest.  (Note that procedure for changing a user's secret key,
                 and later read to determine whether the use of two copies change of
                 the secret, one near secrets was effected.
                "
    DEFVAL      { ''H }  -- the start and one at empty string
    ::= { usecUserEntry 8 }

usecUserPrivProtocol OBJECT-TYPE
    SYNTAX       OBJECT IDENTIFIER
    MAX-ACCESS   read-create
    STATUS       current
    DESCRIPTION "An indication of whether messages sent on behalf of
                 this user to/from the end, is recommended SNMP engine identified by [KEYED-MD5].)

   This protocol uses
                 usecUserEngineID, can be protected from disclosure,
                 and if so, the MD5 [MD5] message digest algorithm.  A 128-bit
   digest type of privacy protocol which is calculated over used.

                 An instance of this object is created concurrently
                 with the designated portion creation of an SNMPv3 message
   and included any other object instance for
                 the same user (i.e., as part of the message sent to the recipient.  The size processing of both
                 the digest carried in a message and set operation which creates the private
   authentication key (the secret) is 16 octets.

6.2  Elements of first object
                 instance in the Digest Authentication Protocol

   This section contains definitions required to realize same conceptual row).  Once created,
                 the
   authentication module defined by this memo.

6.2.1.  SNMPv3 Users

   Authentication using this Digest Authentication protocol makes use value of a defined set an instance of user identities.  For any SNMPv3 user this object can not be
                 changed.
                "
    DEFVAL      { imfNoPrivProtocol }
    ::= { usecUserEntry 9 }

usecUserPrivKeyChange OBJECT-TYPE
    SYNTAX       KeyChange  -- typically (SIZE (0..32))
    MAX-ACCESS   read-create
    STATUS       current
    DESCRIPTION "An object, which when modified, causes the secret
                 encryption key used for messages sent on whose behalf a message must be authenticated at a particular SNMPv3 engine,
   that engine must have knowledge
                 of that user.  An SNMPv3 this user to/from the SNMP engine that
   wishes to communicate with another SNMPv3 engine must also have
   knowledge of a user known identified by
                 usecUserEngineID, to that engine, including knowledge of the
   applicable attributes of that user.

   A user and its attributes are defined as follows:

   <userName>
     An octet string representing the name of the user.

   <authMD5PrivateKey>
     If messages sent on behalf of this user can be authenticated, the
     (private) authentication key for use with the authentication
     protocol.  Note that modified via a user's authentication key will normally be
     different at different authoritative engines.

6.2.2.  EngineID one-way
                 function.

                 The engineID value contained in an authenticated message specifies
   the authoritative SNMPv3 engine for that particular message.
   (see the definition of engineID in associated protocol is the SNMPng Architectural model
   document [SNMPng-ARCH]). usecUserPrivProtocol.
                 The user's (private) authentication associated secret key is normally different at
   each authoritative SNMPv3 engine and so the snmpEngineID user's secret
                 encryption key (usecUserPrivKey).

                 When creating a new user, it is used an 'inconsistentName'
                 error for a set operation to select refer to this object
                 unless it is previously or concurrently initialized
                 through a set operation on the proper key for corresponding value
                 of usecUserCloneFrom.
                "
    DEFVAL      { ''H }    -- the authentication process.

6.2.3.  SNMPv3 Messages Using this Authentication Protocol

   Messages using this authentication protocol carry an authParameters
   field empty string
    ::= { usecUserEntry 10 }

usecUserPrivPublic    OBJECT-TYPE
    SYNTAX       OCTET STRING -- for DES (SIZE(0..16))
    MAX-ACCESS   read-create
    STATUS       current
    DESCRIPTION "A publicly-readable value which is written as part
                 of the securityParameters. For this protocol, the
   authParameters field is the serialized octet string representing procedure for changing a user's secret key,
                 and later read to determine whether the MD5 digest change of
                 the wholeMessage.

   The digest is calculated over the wholeMessage so if a message is
   authenticated, that also means that all the fields in secrets was effected.
                "
    DEFVAL      { ''H }  -- the message
   are intact and have not been tampered with.

6.2.4  Input and Output empty string
    ::= { usecUserEntry 11 }

usecUserStorageType OBJECT-TYPE
    SYNTAX       StorageType
    MAX-ACCESS   read-create
    STATUS       current
    DESCRIPTION "The storage type for this conceptual row."
    DEFVAL      { nonVolatile }
    ::= { usecUserEntry 12 }

usecUserStatus OBJECT-TYPE
    SYNTAX       RowStatus
    MAX-ACCESS   read-create
    STATUS       current
    DESCRIPTION "The status of this conceptual row.  Until instances
                 of all corresponding columns are appropriately
                 configured, the MD5 Authentication Module

   This section describes the inputs and outputs that value of the MD5
   Authentication module expects and produces when corresponding instance
                 of the User-based
   Security module invokes usecUserStatus column is 'notReady'.

                 For those columnar objects which permit write-access,
                 their value in an existing conceptual row can be
                 changed irrespective of the MD5 Authentication module value of usecUserStatus
                 for
   services.

6.2.4.1  Input and Output when generating an that row.
                "
    ::= { usecUserEntry 13 }

usecUserSecretSpinLock  OBJECT-TYPE
    SYNTAX       TestAndIncr
    MAX-ACCESS   read-write
    STATUS       current
    DESCRIPTION "An advisory lock used to allow several cooperating
                 SNMPv3 Message

   When the User-based Security module invokes the MD5 Authentication
   module engines, all acting in a manager role, to authenticate an outgoing message, it must pass as
   arguments:

       <engineID>
          the engineID
                 coordinate their use of the authoritative SNMPv3 engine as it will be
          included facilities to alter secrets
                 in the message.
       <userName>
          the user on whose behalf the message is usecUserTable.

                "
    ::= { usecUser 2 }

--Editor's note
Is it enough to have just one spin-lock for such a table where
several secrets can be authenticated.
       <cachedSecurityData> modified? Can the possible cached security data if this is a response to an
          earlier request message.
       <authParameters>
          the authParameters, to be filled by the authentication module.
       <wholeMessage> protocol ensure the message to be authenticated.

   Output from
consistency? Should it?
--End editor's note

-- Conformance Information *******************************************

snmpUsecMIBCompliances
                 OBJECT IDENTIFIER ::= { snmpUsecMIBConformance 1 }
snmpUsecMIBGroups
                 OBJECT IDENTIFIER ::= { snmpUsecMIBConformance 2 }

-- Compliance statements

snmpUsecMIBCompliance MODULE-COMPLIANCE
    STATUS       current
    DESCRIPTION "The compliance statement for SNMP engines which
                 implement the MD5 Authentication SNMP USEC MIB.
                "

    MODULE       -- this module
        MANDATORY-GROUPS { snmpUsecMIBBasicGroup }

        OBJECT           usecUserGroupName
        MIN-ACCESS       read-only
        DESCRIPTION     "Write access is an error indication or
   the completed wholeMessage (that not required."

        OBJECT           usecUserAuthProtocol
        MIN-ACCESS       read-only
        DESCRIPTION     "Write access is with the digest inserted into
   the authParameters field).  If an error indication not required."

        OBJECT           usecUserPrivProtocol
        MIN-ACCESS       read-only
        DESCRIPTION     "Write access is returned by
   the MD5 Authentication module, then the message cannot be sent.

6.2.4.2  Input and Output when receiving not required."

    ::= { snmpUsecMIBCompliances 1 }

-- Units of compliance

snmpUsecMIBBasicGroup OBJECT-GROUP
    OBJECTS     {
                  usecUserMiId,
                  usecUserGroupName,
                  usecUserCloneFrom,
                  usecUserAuthProtocol,
                  usecUserAuthKeyChange,
                  usecUserAuthPublic,
                  usecUserPrivProtocol,
                  usecUserPrivKeyChange,
                  usecUserPrivPublic,
                  usecUserStorageType,
                  usecUserStatus
                }
    STATUS       current
    DESCRIPTION "A collection of objects providing for configuration
                 of an SNMPv3 Message

   When SNMP engine which implements the SNMP
                 User-based Security module invokes the model.
                "
    ::= { snmpUsecMIBGroups 1 }

END

6.  MD5 Authentication
   module to authenticate an incoming message, it must pass as
   arguments:

       <engineID> Protocol

   This section describes the engineID of Keyed-MD5 authentication protocol.
   This protocol is the authoritative SNMPv3 engine first authentication protocol defined for
   the User-based Security model.
   Over time, other authentication protocols may be defined either
   as it was
          included a replacement of this protocol or in the message.
       <userName>
          the user on whose behalf the addition to this protocol.

6.1  Mechanisms

   - In support of data integrity, a message digest algorithm is to be authenticated.
       <authParameters>
          the authParameters.
       <wholeMessage>
          the message to be authenticated.

   Output from the MD5 Authentication module
     required.  A digest is calculated over an error indication or
   the authentic wholeMessage plus any cachedSecurityData that may be
   needed when authenticating a possible outgoing response to this
   (request) message.

   If appropriate portion
     of an error indication is returned by the MD5 Authentication module,
   then the SNMPv3 message cannot be trusted. In the case that there was not
   enough information in the Security Configuration Database (SCD) to
   actually perform and included as part of the authentication process, then a report PDU may
   have been generated message sent
     to inform the sender about the error condition.

6.3  Elements recipient.

   - In support of Procedure

   This section describes the procedures for the Keyed-MD5 data origin authentication protocol.

6.3.1  Processing an Outgoing Message

   This section describes and data integrity, a
     secret value is both inserted into, and appended to, the procedure followed by an SNMPv3 engine
   whenever it must authenticate an outgoing
     message using prior to computing the
   usecMD5AuthProtocol.

   1)  - If any cachedSecurityData exists for this message, then
         information concerning digest; the user inserted value is extracted from the
         cachedSecurityData.
       - Otherwise, the engineID and the userName are used
     overwritten prior to extract
         the information concerning the user from the Security
         Configuration Datastore (SCD, authMD5Table).

   2)  If transmission, and the engineID appended value is not known
     transmitted.  The secret value is shared by this authentication module,
       then all SNMPv3 engines
     authorized to originate messages on behalf of the message cannot be sent.  An error indication is
       returned appropriate
     user.

   - In order to not expose the calling module.

   3)  If shared secrets (keys) at all SNMPv3
     engines in case one of the userName engines is not known by this authentication module,
       then compromised, such secrets
     (keys) are localized for each authoritative SNMPv3 engine, see
     [Localized-Key].

6.1.1.  Digest Authentication Protocol

   The Digest Authentication Protocol defined in this memo provides for:

   - verifying the integrity of a received message (i.e., the message cannot be sent. An error indication
     received is
       returned to the calling module.

   4) message sent).

     The authParameters field is set to integrity of the serialization according
       to message is protected by computing a digest
     over an appropriate portion of a message.  The digest is computed
     by the rules in [RFC1907] originator of an octet string representing the
       secret (localized) key message, transmitted with the message, and
     verified by the recipient of the user.

   5)  The message.

   - verifying the user on whose behalf the message was generated.

     A secret (localized) key value known only to SNMPv3 engines authorized to generate
     messages on behalf of the a user is then both inserted into, and appended
     to, the message prior to the
       end of digest computation.  Thus, the wholeMessage.

   6)  The MD5-Digest is calculated according to [MD5]. Then
     verification of the
       authParameters field user is replaced implicit with the calculated digest.

   7)  The wholeMessage (excluding verification of the appended secret key) is then
       returned to
     digest.  (Note that the caller.

6.3.2  Processing an Incoming Message

   This section describes use of two copies of the procedure followed by an SNMPv3 engine
   whenever it must authenticate an incoming message using secret, one near
     the
   usecMD5AuthProtocol.

   1)  If start and one at the engineID end, is not known recommended by this authentication module,
       then [KEYED-MD5].)

   This protocol uses the authMD5StatsUnknownEngineIDs counter is incremented,
       a report PDU is generated and an error indication MD5 [MD5] message digest algorithm.  A 128-bit
   digest is returned
       to calculated over the calling module.

   2)  If the userName is not known by this authentication module,
       then the authMD5StatsUnknownUserNames counter is incremented,
       a report PDU is generated and designated portion of an error indication is returned SNMPv3 message
   and included as part of the message sent to the calling module.

   3)  If recipient.  The size
   of both the digest received carried in a message and the authParameters field private
   authentication key (the secret) is not 16 octets long, then octets.

6.2  Elements of the authMD5StatsWrongDigests counter is
       incremented, a report PDU is generated and an error indication
       is returned Digest Authentication Protocol

   This section contains definitions required to realize the calling module.

   4)  The digest received in
   authentication module defined by this memo.

6.2.1.  SNMPv3 Users

   Authentication using this Digest Authentication protocol makes use
   of a defined set of user identities.  For any SNMPv3 user on whose
   behalf a message must be authenticated at a particular SNMPv3 engine,
   that engine must have knowledge of that user.  An SNMPv3 engine that
   wishes to communicate with another SNMPv3 engine must also have
   knowledge of a user known to that engine, including knowledge of the authParameters field is saved.

   5)  The engineID
   applicable attributes of that user.

   A user and the userName its attributes are used to extract information
       concerning defined as follows:

   <userName>
     A string representing the user from name of the Security Configuration Datastore
       (SCD, authMD5Table).

   6) user.
   <authKey>
     A user's secret key to be used when calculating a digest.

6.2.2.  EngineID

   The digest engineID value contained in an authenticated message specifies
   the authParameters field is replaced by authoritative SNMPv3 engine for that particular message.
   (see the user's
       secret (localized) key.

   7)  The secret (localized) key definition of engineID in the user SNMP Architecture document
   [SNMP-ARCH]).

   The user's (private) authentication key is then appended normally different at
   each authoritative SNMPv3 engine and so the snmpEngineID is used
   to select the
       end proper key for the authentication process.

6.2.3.  SNMPv3 Messages Using this Authentication Protocol

   Messages using this authentication protocol carry an authParameters
   field as part of the wholeMessage.

   8)  The MD5-Digest is calculated according to [MD5].
       The securityParameters. For this protocol, the
   authParameters field is replaced with the serialized octet string representing
   the MD5 digest value
       that was saved in step 4).

   9)  Then of the newly calculated wholeMsg.

   The digest is compared with calculated over the digest
       saved wholeMsg so if a message is
   authenticated, that also means that all the fields in step 4). If the digests do message
   are intact and have not match, then been tampered with.

6.2.4  Input and Output of the
       authMD5StatsUnknownUserNames counter is incremented, a report
       PDU is generated MD5 Authentication Module
   This section describes the inputs and outputs that the MD5
   Authentication module expects and produces when the User-based
   Security module invokes the MD5 Authentication module for
   services.

6.2.4.1  Input and Output when generating an error indication SNMPv3 Message

   This MD5 authentication protocol assumes that the selection of the
   authKey is returned to done by the
       calling module.

   10) caller and that the caller passes
   the secret key to be used. The abstract service interface is:

          authMsg(authKey, wholeMsg)

   Where:

          authKey
            The secret key (used for calculating to be used by the digest) is cached authentication algorithm.
          wholeMsg
            the message to be authenticated.

   Upon completion the authentication module returns information.
   The abstract service interface is:

        returnAuthMsg(wholeMsg, statusCode)

   Where:

        wholeMsg
          Same as part in input, but with authParameters properly filled.
        statusCode
          The indicator of whether the cachedSecurityData.

   11) The wholeMessage (excluding message was successfully
          processed or not.

   Note, that <authParameters> is filled by the appended secret key) authentication module
   and this field should be already present in the
       cachedSecurityData <wholeMsg> before
   the MAC is then returned to the caller.

6.4  Definitions

SNMPv3-AUTH-MD5-MIB DEFINITIONS ::= BEGIN

IMPORTS
    Counter32, Unsigned32,
    MODULE-IDENTITY, OBJECT-TYPE, snmpModules  FROM SNMPv2-SMI
    TEXTUAL-CONVENTION, TestAndIncr,
    RowStatus, AutonomousType, StorageType,
    TDomain, TAddress, RowPointer              FROM SNMPv2-TC
    MODULE-COMPLIANCE, OBJECT-GROUP            FROM SNMPv2-CONF,
    SnmpV3GroupName, SnmpV3ContextName,
    SnmpV3LoS, SnmpV3EngineID,
    SnmpV3SecurityModel                        FROM SNMPv3-MIB,
    UserName, usecMD5AuthProtocol              FROM SNMPv3-USEC-MIB;

authMD5MIB MODULE-IDENTITY
    LAST-UPDATED "9705090000Z"     -- 09 May 1997, midnight
    ORGANIZATION "SNMPv3 Working Group"
    CONTACT-INFO "WG-email:   snmpv3@tis.com
                  Subscribe:  majordomo@tis.com
                              In msg body:  subscribe snmpv3

                  Chair:      Russ Mundy
                              Trutsed Information Systems
                  postal:     3060 Washington Rd
                              Glenwood MD 21738
                  email:      mundy@tis.com
                  phone:      301-854-6889

                  Co-editor   Uri Blumenthal
                              IBM T. J. Watson Research
                  postal:     30 Saw Mill River Pkwy,
                              Hawthorne, NY 10532
                              USA
                  email:      uri@watson.ibm.com
                  phone:      +1.914.784.7964

                  Co-editor:  Bert Wijnen
                              IBM T. J. Watson Research
                  postal:     Schagen 33
                              3461 GL Linschoten
                              Netherlands
                  email:      wijnen@vnet.ibm.com
                  phone:      +31-348-412-498
                 "

    DESCRIPTION  "The management information definitions for the
                  Keyed-MD5 authentication protocol for use with the
                  SNMPv3 User-based Security model.
                 "
    ::= { snmpModules xx }

-- Administrative assignments ****************************************

authMD5Admin           OBJECT IDENTIFIER ::= { authMD5MIB 1 }
authMD5MIBObjects      OBJECT IDENTIFIER ::= { authMD5MIB 2 }
authMD5MIBConformance  OBJECT IDENTIFIER ::= { authMD5MIB 3 }

-- Textual  Conventions **********************************************

-- Editor's note:
-- Do we need to define this so generic.
-- Maybe we can just assume the usecAuthMD5Protocol
-- If we make it generic, then we can use this TC with several
-- ciphers - those we use now, and those people might want to
-- use in the future, like IDEA, Blowfish, SEAL, whatever...
-- But certainly for now it makes this TC more complicated then
-- what we need now.
-- End Editor's note

KeyChange ::= TEXTUAL-CONVENTION
    STATUS       current
    DESCRIPTION
         "Every definition of an object with this syntax must identify
          a protocol, P, and a secret key, K.  The object's value is a
          manager-generated, partially-random value which, when
          modified, causes the value of the secret key, K, to be
          modified via a one-way function.

          The value of an instance of this object is the concatenation
          of two components: a 'random' component and a 'delta'
          component.  The lengths of the random and delta components are
          given by the corresponding value of the protocol, P; if P
          requires K to be a fixed length, the length of both the random
          and delta components is that fixed length; if P allows the
          length of K to be variable up to a particular maximum length,
          the length of the random component is that maximum length and
          the length of the delta component is any length less than or
          equal to that maximum length.  For example,
          usecMD5AuthProtocol requires K to be a fixed length of 16
          octets.  Other protocols may define other sizes, as deemed
          appropriate.

          When an instance of this object is modified to have a new
          value by the management protocol, the agent generates a new
          value of K as follows:

           - a temporary variable is initialized to the existing value
             of K;
           - if the length of the delta component is greater than 16
             bytes, then:

              - the random component is appended to the value of the
                temporary variable, and the result is input to the MD5
                hash algorithm to produce a digest value, and the
                temporary variable is set to this digest value;
              - the value of the temporary variable is XOR-ed with the
                first (next) 16-bytes of the delta component to produce
                the first (next) 16-bytes of the new value of K.
              - the above two steps are repeated until the unused
                portion of the delta component is 16 bytes or less,
           - the random component is appended to the value of the
             temporary variable, and the result is input to the MD5
             hash algorithm to produce a digest value;
           - this digest value, truncated if necessary to be the same
             length as the unused portion of the delta component, is
             XOR-ed with the unused portion of the delta component to
             produce the (final portion of the) new value of K.

             i.e.,

                iterations = (lenOfDelta - 1)/16; /* integer division */
                temp = keyOld;
                for (i = 0; i < iterations; i++) {
                   temp = MD5 (temp || random);
                   keyNew[i*16 .. (i*16)+15] =
                          temp XOR delta[i*16 .. (i*16)+15];
                }
                temp = MD5 (temp || random);
                keyNew[i*16 .. lenOfDelta-1] =
                       temp XOR delta[i*16 .. lenOfDelta-1];

          The value of an object with this syntax, whenever it is
          retrieved by the management protocol, is always the zero-
          length string."
    SYNTAX      OCTET STRING

-- *******************************************************************

authMD5Stats OBJECT IDENTIFIER ::= { authMD5MIBObjects 1 }

authMD5StatsUnknownUserNames OBJECT-TYPE
    SYNTAX       Counter32
    MAX-ACCESS   read-only
    STATUS       current
    DESCRIPTION "The total number of packets received by the SNMPv3
                 engine which were dropped because they referenced a
                 user that was not known to the MD5 authentication
                 module in the engine.
                "
    ::= { authMD5Stats 1 }

authMD5StatsUnknownEngineIDs OBJECT-TYPE
    SYNTAX       Counter32
    MAX-ACCESS   read-only
    STATUS       current
    DESCRIPTION "The total number of packets received by the SNMPv3
                 engine which were dropped because they referenced an
                 engineID that was not known to the MD5 authentication
                 module in the engine.
                "
    ::= { authMD5Stats 2 }

authMD5StatsWrongDigests OBJECT-TYPE
    SYNTAX       Counter32
    MAX-ACCESS   read-only
    STATUS       current
    DESCRIPTION "The total number of packets received by the SNMPv3
                 engine which were dropped because they didn't
                 contain the expected digest value.
                "
    ::= { authMD5Stats 3 }

-- *******************************************************************

authMD5Table     OBJECT-TYPE
    SYNTAX       SEQUENCE OF AuthMD5TableEntry
    MAX-ACCESS   not-accessible
    STATUS       current
    DESCRIPTION "The SNMPv3 security configuration database (SCD) for
                 authentication information for users who use the
                 usecAuthMD5Protocol as the authentication protocol.
                "
    ::= { authMD5MIBObjects 2 }

authMD5TableEntry OBJECT-TYPE
    SYNTAX       AuthMD5TableEntry
    MAX-ACCESS   not-accessible
    STATUS       current
    DESCRIPTION "An entry for a particular SNMPv3 user and engineID."
    INDEX       { authMD5EngineID,
                  IMPLIED authMD5UserName
                }
    ::= { authMD5Table 1 }

AuthMD5TableEntry ::= SEQUENCE {
    authMD5EngineID         SnmpV3EngineID,
    authMD5UserName         UserName,
    authMD5KeyChange        KeyChange,
    authMD5CloneFrom        RowPointer,
    authMD5Public           OCTET STRING,
    authMD5StorageType      StorageType,
    authMD5Status           RowStatus
}

authMD5EngineID OBJECT-TYPE
    SYNTAX      SnmpEngineID
    MAX-ACCESS  not-accessible
    STATUS      current
    DESCRIPTION "An SNMPv3 engine's administratively-unique identifier.

                 In a simple agent, this value is always that agent's
                 own snmpEngineID value.

                 This value can also take the value of the snmpEngineID
                 of a remote SNMP engine with which this user can
                 communicate.
                "
    ::= { authMD5TableEntry 1 }

authMD5UserName  OBJECT-TYPE
    SYNTAX       UserName
    MAX-ACCESS   not-accessible
    STATUS       current
    DESCRIPTION "An octet string representing the name of the user."
    ::= { authMD5TableEntry 2 }

authMD5KeyChange OBJECT-TYPE
    SYNTAX       KeyChange  -- typically (SIZE (0..32))
    MAX-ACCESS   read-create
    STATUS       current
    DESCRIPTION "An object, which when modified, causes the secret
                 authentication key used for messages sent on behalf
                 of this user to/from the engine identified by
                 authMD5EngineID, to be modified via a one-way function.

                 The associated protocol is the usecAuthMD5Protocol.
                 The associated secret key is the user's secret
                 authentication key.

                 When creating a new user, it is an 'inconsistentName'
                 error for a set operation to refer to this object
                 unless it is previously or concurrently initialized
                 through a set operation on the corresponding value
                 of authMD5CloneFrom.
                "
    DEFVAL      { ''H }    -- the empty string
    ::= { authMD5TableEntry 3 }

authMD5CloneFrom OBJECT-TYPE
    SYNTAX       RowPointer
    MAX-ACCESS   read-create
    STATUS       current
    DESCRIPTION "A pointer to another conceptual row in this
                 authMD5Table.  The user in this other conceptual row
                 is called the clone-from user.

                 When a new user is created (i.e., a new conceptual row
                 is instantiated in this table), the authentication
                 parameters of the new user are cloned from its
                 clone-from user.

                 The first time an instance of this object is set by a
                 management operation (either at or after its
                 instantiation), the cloning process is invoked.
                 Subsequent writes are successful but invoke no action
                 to be taken by the agent.
                 The cloning process fails with an 'inconsistentName'
                 error if the conceptual row representing the
                 clone-from user is not in an active state when the
                 cloning process is invoked.

                 Cloning also causes the initial values of the secret
                 authentication key of the new user to be set to the
                 same value as the corresponding secret of the
                 clone-from user.

                 When this object is read, the zero length string is
                 returned.
                "
    ::= { authMD5TableEntry 4 }

authMD5Public    OBJECT-TYPE
    SYNTAX       OCTET STRING (SIZE(0..32))
    MAX-ACCESS   read-create
    STATUS       current
    DESCRIPTION "A publicly-readable value which is written as part
                 of the procedure for changing a user's secret key,
                 and later read to determine whether the change of
                 the secrets was effected.
                "
    DEFVAL      { ''H }  -- the empty string
    ::= { authMD5TableEntry 5 }

authMD5StorageType OBJECT-TYPE
    SYNTAX       StorageType
    MAX-ACCESS   read-create
    STATUS       current
    DESCRIPTION "The storage type for this conceptual row.

                 Conceptual rows having the value 'permanent' must allow
                 write-access at a minimum to authMD5KeyChange and
                 authMD5Public.

                 Note that any user which employs authentication must
                 allow its secret to be updated and thus an entry in
                 this table cannot be 'readOnly'.
                "
    DEFVAL      { nonVolatile }
    ::= { authMD5TableEntry 6 }

authMD5Status    OBJECT-TYPE
    SYNTAX       RowStatus
    MAX-ACCESS   read-create
    STATUS       current
    DESCRIPTION "The status of this conceptual row.  Until instances of
                 all corresponding columns are appropriately configured,
                 the value of the corresponding instance of the
                 authMD5Status column is 'notReady'.  In particular,
                 a value must have been written to the authMD5CloneFrom
                 column.

                 For those columnar objects which permit write-access,
                 their value in an existing conceptual row can be
                 changed irrespective of the value of authMD5Status for
                 that row.
                "
    ::= { authMD5TableEntry 7 }

authMD5SecretSpinLock  OBJECT-TYPE
    SYNTAX       TestAndIncr
    MAX-ACCESS   read-write
    STATUS       current
    DESCRIPTION "An advisory lock used to allow several cooperating
                 SNMPv3 engines, all acting in a manager role, to
                 coordinate their use of facilities to alter secrets
                 in the authMD5Table.
                "
    ::= { authMD5MIBObjects 3 }

-- Conformance Information *******************************************

authMD5MIBCompliances
               OBJECT IDENTIFIER ::= { authMD5MIBConformance 1 }
authMD5MIBGroups
               OBJECT IDENTIFIER ::= { authMD5MIBConformance 2 }

-- Compliance statements

authMD5MIBCompliance MODULE-COMPLIANCE
    STATUS       current
    DESCRIPTION "The compliance statement for SNMPv3 engines which
                 implement the SNMPv3 authMD5 MIB.
                "

    MODULE       -- this module
        MANDATORY-GROUPS { authMD5MIBBasicGroup }
    ::= { authMD5MIBCompliances 1 }

-- Units of compliance

authMD5MIBBasicGroup OBJECT-GROUP
    OBJECTS     { authMD5StatsUnknownUserNames,
                  authMD5StatsUnknownEngineIDs,
                  authMD5StatsWrongDigests,
                  authMD5KeyChange,
                  authMD5CloneFrom,
                  authMD5Public,
                  authMD5StorageType,
                  authMD5Status,
                  authMD5SecretSpinLock
                }
    STATUS       current
    DESCRIPTION "A collection of objects providing for configuration
                 of an SNMPv3 entity which implements the SNMPv3
                 MD5 Authentication Protocol.
                "
    ::= { authMD5MIBGroups 1 }

END

7.  DES Privacy Protocol

   This section describes the DES privacy protocol.
   This protocol is the first privacy protocol defined for the
   User-based Security model.
   Over time, other privacy protocols may be defined either
   as a replacement of this protocol or in addition to this protocol.

7.1  Mechanisms

   - In support of data confidentiality, an encryption algorithm is
     required.  An appropriate portion of the message is encrypted
     prior to being transmitted. The User-based Security model
     specifies that the scopedPDU is the portion of the message
     that needs to be encrypted.

   - A secret value is in combination with a time value is used to
     create the en/decryption key and the initialization vector.
     The secret value is shared by all SNMPv3 engines authorized to
     originate messages on behalf of the appropriate user.

   - In order to not expose the shared secrets (keys) at all SNMPv3
     engines in case one of the engines is compromised, such secrets
     (keys) are localized for each authoritative SNMPv3 engine, see
     [Localized-Key].

7.1.1.  Symmetric Encryption Protocol

   The Symmetric Encryption Protocol defined in this memo provides
   support for data confidentiality.  The designated portion of an
   SNMPv3 message is encrypted and included as part of the message
   sent to the recipient.

   This memo requires that if data confidentiality is supported by
   an SNMPv3 engine, this engine must implement at least the Data
   Encryption Standard (DES) in the Cipher Block Chaining mode of
   operation.

   Two organizations have published specifications defining the DES: the
   National Institute of Standards and Technology (NIST) [DES-NIST] and
   the American National Standards Institute [DES-ANSI].  There is a
   companion Modes of Operation specification for each definition
   (see [DESO-NIST] and [DESO-ANSI], respectively).

   The NIST has published three additional documents that implementers
   may find useful.

   - There is a document with guidelines for implementing and using the
     DES, including functional specifications for the DES and its modes
     of operation [DESG-NIST].

   - There is a specification of a validation test suite for the DES
     [DEST-NIST].  The suite is designed to test all aspects of the DES
     and is useful for pinpointing specific problems.

   - There is a specification of a maintenance test for the DES
     [DESM-NIST].  The test utilizes a minimal amount of data and
     processing to test all components of the DES.  It provides a
     simple yes-or-no indication of correct operation and is useful
     to run as part of an initialization step, e.g., when a computer
     re-boots.

7.1.1.1  DES key and Initialization Vector.

   The first 8 bytes of the 16-byte secret (private privacy key) are
   used as a DES key.
   Since DES uses only 56 bits, the Least Significant Bit in each
   byte is disregarded.

   The Initialization Vector for encryption is obtained using the
   following procedure.
   The last 8 bytes of the 16-byte secret (private privacy key) are
   used as pre-IV.  The 32-bit engineTime is converted to a 4-byte
   octet string, Most Significant Byte first.  This octet string is
   XOR-ed with the first four bytes of the pre-IV.  The result is the
   Initialization Vector to be used in the subsequent encryption.
   The engine must ensure that the same value of engineTime is encoded
   in the securityParameters structure.

-- Editor's note:
   Possibly, if we want to keep things clean and properly separated,
   then the engineTime should be duplicated in the privParameters.
   The engineTime in the header of the securityParameters is used for
   the timeliness checks, and so is used/handled in a different module.
   Do we want those extra bytes on the wire?
-- End Editor's note

7.1.1.2  Data Encryption.

   The data to be encrypted is treated as sequence of octets. Its
   length should be an integral multiple of 8 - and if not, the
   data is padded at the end as necessary. The actual pad value
   is irrelevant.

   The data is encrypted in Cipher Block Chaining mode.
   The plaintext is divided into 64-bit blocks.

   The plaintext for each block is XOR-ed with the ciphertext
   of the previous block, the result is encrypted and the output
   of the encryption is the ciphertext for the block.
   This procedure is repeated until there are no more plaintext
   blocks.

   For the very first block, the Initialization Vector is used
   instead of the ciphertext of the previous block.

7.1.1.3  Data Decryption

   Before decryption, the encrypted data length is verified.
   If the length of the octet sequence to be decrypted is not an
   integral multiple of 8 octets, the processing of the octet sequence
   is halted and an appropriate exception noted.  When decrypting, the
   padding is ignored.

   The first ciphertext block is decrypted, the decryption output is
   XOR-ed with the Initialization Vector, and the result is the first
   plaintext block.

   For each subsequent block, the ciphertext block is decrypted,
   the decryption output is XOR-ed with the previous ciphertext
   block and the result is the plaintext block.

7.2  Elements of the DES Privacy Protocol

   This section contains definitions required to realize the privacy
   module defined by this memo.

7.2.1.  SNMPv3 Users

   Data En/Decryption using this Symmetric Encryption Protocol makes use
   of a defined set of user identities.  For any SNMPv3 user on whose
   behalf a message must be en/decrypted at a particular SNMPv3 engine,
   that engine must have knowledge of that user.  An SNMPv3 engine that
   wishes to communicate with another SNMPv3 engine must also have
   knowledge of a user known to that engine, including knowledge of the
   applicable attributes of that user.

   A user and its attributes are defined as follows:

   <userName>
     An octet string representing the name of the user.

   <privDESPrivateKey>
     If messages sent on behalf of this user can be en/decrypted, the
     (private) privacy key for use with the privacy protocol. Note that
     a user's privacy key will normally be different at different
     authoritative engines.

7.2.2.  EngineID

   The engineID value contained in generated.

6.2.4.2  Input and Output when receiving an authenticated message specifies
   the authoritative SNMPv3 engine for Message

   This MD5 authentication protocol assumes that particular message.
   (see the definition selection of engineID in the SNMPng Architectural model
   document [SNMPng-ARCH]).

   The user's (private) authentication key
   authKey is normally different at
   each authoritative SNMPv3 engine done by the caller and so that the snmpEngineID is caller passes
   the secret key to be used. The abstract service interface is:

        authIncomingMsg(authKey, authParameters, wholeMsg)

   Where:

        authKey
          The secret key to be used by the authentication algorithm.
        authParameters
          the authParameters from the incoming message.

        wholeMsg
          the message to select be authenticated.

   Upon completion the proper key authentication module returns information.
   The abstract service interface is:

        returnAuthIncomingMsg(wholeMsg, statusCode)

        wholeMsg
          Same as in input, data has been authenticated.
        statusCode
          The indicator of whether the message was successfully
          processed or not.

6.3  Elements of Procedure

   This section describes the procedures for the Keyed-MD5
   authentication process.

7.2.3. protocol.

6.3.1  Processing an Outgoing Message

   This section describes the procedure followed by an SNMPv3 Messages Using this Privacy Protocol

   Messages engine
   whenever it must authenticate an outgoing message using this privacy protocol carry a privParameters
   field as part of the securityParameters. For this protocol, the
   privParameters
   imfAuthMD5Protocol.

   1)  The authParameters field is set to the serialized serialization according
       to the rules in [RFC1906] of an octet string representing
   a NULL (zero length) string.

7.2.4  Input and Output of the DES Privacy Module

   This section describes the inputs and outputs that
       secret (localized) authKey.

   2)  The secret (localized) authKey is then appended to the DES Privacy
   module expects and produces when end of
       the User-based Security module
   invokes wholeMsg.

   3)  The MD5-Digest is calculated according to [MD5]. Then the DES Privacy module for services.

7.2.4.1  Input and Output when generating an SNMPv3 Message

   When
       authParameters field is replaced with the User-based Security module invokes calculated digest.

   4)  The wholeMsg (excluding the DES Privacy module appended secret key) is then
       returned to encrypt part of an outgoing message, it must pass as arguments:

       <engineID> the engineID caller together with a statusCode of success.

6.3.2  Processing an Incoming Message

   This section describes the authoritative procedure followed by an SNMPv3 engine as
   whenever it will be
          included in must authenticate an incoming message using the message.
       <userName>
   imfAuthMD5Protocol.

   1)  If the user on whose behalf digest received in the message authParameters field is not
       16 octets long, then an error indication (authenticationError)
       is returned to be encrypted.
       <engineTime> the engineTime value as it will be included calling module.

   2)  The digest received in the message.
       <cachedSecurityData> authParameters field is saved.

   3)  The digest in the possible cached security data if this authParameters field is a response to an
          earlier request message.
       <scopedPDU> replaced by the data
       secret (localized) authKey.

   4)  The secret (localized) authKey is then appended to be encrypted.

   Upon completion the privacy module must return either an error
   indication or:

       <encryptedPDU> end of
       the encrypted scopedPDU (encoded as an octet string).
       <privParameters> wholeMsg.

   5)  The privacy parameters (encoded as an octet string) that need MD5-Digest is calculated according to be sent [MD5].
       The authParameters field is replaced with the digest value
       that was saved in step 2).

   6)  Then the outgoing message.

7.2.4.2  Input and Output when receiving an SNMPv3 Message

   When newly calculated digest is compared with the User-based Security module invokes digest
       saved in step 2). If the DES Privacy module
   to decrypt part of digests do not match, then an incoming message, it must pass as arguments:

       <snmpEngineID>
          the engineID of error
       indication (authenticationError) is returned to the authoritative SNMPv3 engine as it was
          included in calling
       module.

   7)  The wholeMsg (excluding the message.
       <userName> appended secret key) and a
       statusCode of success are then returned to the user on whose behalf caller.

7.  DES Privacy Protocol

   This section describes the message DES privacy protocol.
   This protocol is to be decrypted.
       <engineTime> the engineTime value first privacy protocol defined for the
   User-based Security model.
   Over time, other privacy protocols may be defined either
   as it was included a replacement of this protocol or in the message.
       <encryptedPDU>
          the data addition to be decrypted

       Output expected from the privacy module is this protocol.

7.1  Mechanisms

   - In support of data confidentiality, an error code or:

       <cachedSecurityData> encryption algorithm is
     required.  An appropriate portion of the cached security data so message is encrypted
     prior to being transmitted. The User-based Security model
     specifies that it can be used later when
       <scopedPDU> the decrypted scopedPDU.

   If an error indication scopedPDU is returned by the DES Privacy module, then portion of the message cannot
     that needs to be decrypted and so the data encrypted.

   - A secret value is unusable and
   cannot be trusted.  In the case that there was not enough
   information in combination with a time value is used to
     create the Security Configuration Database (SCD) en/decryption key and the initialization vector.
     The secret value is shared by all SNMPv3 engines authorized to
   actually perform
     originate messages on behalf of the privacy process, then a report PDU may
   have been generated appropriate user.

   - In order to inform not expose the sender about shared secrets (keys) at all SNMPv3
     engines in case one of the error condition.

7.3  Elements engines is compromised, such secrets
     (keys) are localized for each authoritative SNMPv3 engine, see
     [Localized-Key].

7.1.1.  Symmetric Encryption Protocol

   The Symmetric Encryption Protocol defined in this memo provides
   support for data confidentiality.  The designated portion of an
   SNMPv3 message is encrypted and included as part of Procedure.

   This section describes the procedures for message
   sent to the DES privacy protocol.

7.3.1  Processing an Outgoing Message recipient.

   This section describes the procedure followed memo requires that if data confidentiality is supported by
   an SNMPv3 engine, this engine
   whenever it must encrypt part of an outgoing message using implement at least the
   usecDESPrivProtocol.

   1)  - If any cachedSecurityData exists for this message, then
         information concerning Data
   Encryption Standard (DES) in the user is extracted from Cipher Block Chaining mode of
   operation.

   Two organizations have published specifications defining the
         cachedSecurityData.
       - Otherwise, DES: the engineID
   National Institute of Standards and Technology (NIST) [DES-NIST] and
   the userName are used to extract
         the information concerning the user from American National Standards Institute [DES-ANSI].  There is a
   companion Modes of Operation specification for each definition
   (see [DESO-NIST] and [DESO-ANSI], respectively).

   The NIST has published three additional documents that implementors
   may find useful.

   - There is a document with guidelines for implementing and using the Security
         Configuration Datastore (SCD, privDESTable).

   2)  If
     DES, including functional specifications for the engineID DES and its modes
     of operation [DESG-NIST].

   - There is not known by this privacy module,
       then a specification of a validation test suite for the message cannot be sent.  An error indication DES
     [DEST-NIST].  The suite is
       returned designed to test all aspects of the calling module.

   3)  If the userName DES
     and is not known by this privacy module,
       then the message cannot be sent. An error indication useful for pinpointing specific problems.

   - There is
       returned to a specification of a maintenance test for the calling module.

   4) DES
     [DESM-NIST].  The authParameters field is set test utilizes a minimal amount of data and
     processing to test all components of the serialization according DES.  It provides a
     simple yes-or-no indication of correct operation and is useful
     to the rules in [RFC1907] run as part of an octet string representing the
       the NULL (zero length) string.

   5)  The secret (localized) initialization step, e.g., when a computer
     re-boots.

7.1.1.1  DES key of the user and Initialization Vector.

   The first 8 bytes of the engineTime 16-byte secret (private privacy key) are
       then
   used to construct the as a DES encryption key and pre-IV (as
       described key.
   Since DES uses only 56 bits, the Least Significant Bit in 7.1.1.1).

   6)  The scopedPDU each
   byte is encrypted (as described in 7.1.1.2) and the
       encrypted data disregarded.

   The Initialization Vector for encryption is serialized according to obtained using the rules in [RFC1907]
       as an octet string.

   7)
   following procedure.

   The last 8 bytes of the serialized octet string representing the 16-byte secret (private privacy key)
   are used as pre-IV.

   In order to ensure that IV for two different packets encrypted
       scopedPDU and
   by the cachedSecurityData together with same key, are not the
       privParameters is returned same (i.e. IV does not repeat) we
   need to "salt" the caller.

7.3.2  Processing an Incoming Message

   This section describes pre-IV with something unique per packet.
   An 8-byte octet string is used as the procedure followed by an SNMPv3 engine
   whenever it must decrypt part "salt". The concatenation
   of an incoming message using the
   usecDESPrivProtocol.

   1)  If generating engine's 32-bit snmpEngineBoots and a local
   32-bit integer that the engineID encryption engine maintains is not known by this privacy module, then input to
   the
       privDESStatsUnknownEngineIDs counter "salt".  The 32-bit integer is incremented, initialized to a report
       PDU random value
   at boot time.  The 32-bit snmpEngineBoots is generated and an error indication converted to the first
   4 bytes (Most Significant Byte first) of our "salt". The 32-bit
   integer is returned then converted to the
       calling module.

   2)  If the userName last 4 bytes (Most Significant
   Byte first) of our "salt". The resulting "salt" is not known by this privacy module, then XOR-ed
   with the
       privDESStatsUnknownUserNames counter is incremented, a report
       PDU pre-IV. The 8-byte salt is generated and then put into the privParameters
   field as an error indication octet-string.  The "salt" integer is returned to incremented by one
   and wraps when it reaches the
       calling module.

   3)  If maximum value.

   The "salt" must be placed in the privParameters field is not the NULL (zero length) string,
       then to enable the privDESStatsDecryptionErrors counter is incremented,
       a report PDU is generated and an error indication is returned
   receiving entity to compute the calling module.

   4)  The engineID correct IV and the userName are used to extract information
       concerning decrypt the user from
   message.

   How exactly the Security Configuration Datastore
       (SCD, privDESTable).

   5)  The secret (localized) key value of the user and "salt" (and thus of the engineTime IV) varies,
   is an implementation issue, as long as the measures are
       then used taken to construct the DES decryption key
   avoid producing a duplicate IV.

7.1.1.2  Data Encryption.

   The data to be encrypted is treated as sequence of octets. Its
   length should be an integral multiple of 8 - and pre-IV (as
       described in 7.1.1.1).

   6) if not, the
   data is padded at the end as necessary. The encryptedPDU actual pad value
   is decrypted (as described irrelevant.

   The data is encrypted in 7.1.1.3).

   7)  If Cipher Block Chaining mode.
   The plaintext is divided into 64-bit blocks.

   The plaintext for each block is XOR-ed with the encryptedPDU cannot be decrypted, then ciphertext
   of the
       privDESStatsDecryptionErrors counter is incremented, a report
       PDU previous block, the result is generated encrypted and an error indication is returned to the
       calling module.

   8)  The secret (localized) key (used output
   of the encryption is the ciphertext for constructing the DES
       decryption key and block.
   This procedure is repeated until there are no more plaintext
   blocks.

   For the very first block, the pre-IV) Initialization Vector is cached as part used
   instead of the
       cachedSecurityData.

   9)  The decrypted ciphertext of the previous block.

7.1.1.3  Data Decryption

   Before decryption, the encrypted data length is returned to verified.
   If the calling module as length of the
       scopedPDU together with octet sequence to be decrypted is not an
   integral multiple of 8 octets, the cachedSecurityData.

7.4  Definitions

SNMPv3-PRIV-DES-MIB DEFINITIONS ::= BEGIN

IMPORTS
    Counter32, Unsigned32,
    MODULE-IDENTITY, OBJECT-TYPE, snmpModules  FROM SNMPv2-SMI
    TEXTUAL-CONVENTION, TestAndIncr,
    RowStatus, AutonomousType, StorageType,
    TDomain, TAddress, RowPointer              FROM SNMPv2-TC
    MODULE-COMPLIANCE, OBJECT-GROUP            FROM SNMPv2-CONF,
    SnmpV3GroupName, SnmpV3ContextName,
    SnmpV3LoS, SnmpV3EngineID,
    SnmpV3SecurityModel                        FROM SNMPv3-MIB,
    UserName, usecDESPrivProtocol              FROM SNMPv3-USEC-MIB,
    KeyChange                                  FROM SNMPv3-AUTH-MD5-MIB;
privDESMIB MODULE-IDENTITY
    LAST-UPDATED "9705090000Z"     -- 09 May 1997, midnight
    ORGANIZATION "SNMPv3 Working Group"
    CONTACT-INFO "WG-email:   snmpv3@tis.com
                  Subscribe:  majordomo@tis.com
                              In msg body:  subscribe snmpv3

                  Chair:      Russ Mundy
                              Trutsed Information Systems
                  postal:     3060 Washington Rd
                              Glenwood MD 21738
                  email:      mundy@tis.com
                  phone:      301-854-6889

                  Co-editor   Uri Blumenthal
                              IBM T. J. Watson Research
                  postal:     30 Saw Mill River Pkwy,
                              Hawthorne, NY 10532
                              USA
                  email:      uri@watson.ibm.com
                  phone:      +1.914.784.7964

                  Co-editor:  Bert Wijnen
                              IBM T. J. Watson Research
                  postal:     Schagen 33
                              3461 GL Linschoten
                              Netherlands
                  email:      wijnen@vnet.ibm.com
                  phone:      +31-348-412-498
                 "

    DESCRIPTION  "The management information definitions for processing of the
                  Keyed-MD5 authentication protocol for use with octet sequence
   is halted and an appropriate exception noted.  When decrypting, the
                  SNMPv3 User-based Security model.
                 "
    ::= { snmpModules xx }

-- Administrative assignments ****************************************

privDESAdmin           OBJECT IDENTIFIER ::= { privDESMIB 1 }
privDESMIBObjects      OBJECT IDENTIFIER ::= { privDESMIB 2 }
privDESMIBConformance  OBJECT IDENTIFIER ::= { privDESMIB 3 }

-- *******************************************************************

privDESStats OBJECT IDENTIFIER ::= { privDESMIBObjects 1 }

privDESStatsUnknownUserNames OBJECT-TYPE
    SYNTAX       Counter32
    MAX-ACCESS   read-only
    STATUS       current
    DESCRIPTION "The total number of packets received by
   padding is ignored.

   The first ciphertext block is decrypted, the SNMPv3
                 engine which were dropped because they referenced a
                 user that was not known to decryption output is
   XOR-ed with the DES privacy module
                 in Initialization Vector, and the engine.
                "
    ::= { privDESStats 1 }

privDESStatsUnknownEngineIDs OBJECT-TYPE
    SYNTAX       Counter32
    MAX-ACCESS   read-only
    STATUS       current
    DESCRIPTION "The total number result is the first
   plaintext block.

   For each subsequent block, the ciphertext block is decrypted,
   the decryption output is XOR-ed with the previous ciphertext
   block and the result is the plaintext block.

7.2  Elements of packets received by the SNMPv3
                 engine which were dropped because they referenced an
                 engineID that was not known DES Privacy Protocol

   This section contains definitions required to realize the DES privacy
   module
                 in the engine.
                "
    ::= { privDESStats 2 }

privDESStatsDecryptionErrors OBJECT-TYPE
    SYNTAX       Counter32
    MAX-ACCESS   read-only
    STATUS       current
    DESCRIPTION "The total number of packets received defined by the SNMPv3
                 engine which were dropped because they could not be
                 decrypted.
                "
    ::= { privDESStats 3 }

-- *******************************************************************

privDESTable     OBJECT-TYPE
    SYNTAX       SEQUENCE OF PrivDESTableEntry
    MAX-ACCESS   not-accessible
    STATUS       current
    DESCRIPTION "The this memo.

7.2.1.  SNMPv3 security configuration database (SCD) for
                 privacy information for users who Users

   Data En/Decryption using this Symmetric Encryption Protocol makes use the
                 usecDESPrivProtocol as the privacy protocol.
                "
    ::= { privDESMIBObjects 2 }

privDESTableEntry OBJECT-TYPE
    SYNTAX       PrivDESTableEntry
    MAX-ACCESS   not-accessible
    STATUS       current
    DESCRIPTION "An entry for
   of a particular defined set of user identities.  For any SNMPv3 user and engineID."
    INDEX       { privDESEngineID,
                  IMPLIED privDESUserName
                }
    ::= { privDESTable 1 }

PrivDESTableEntry ::= SEQUENCE {
    privDESEngineID        SnmpV3EngineID,
    privDESUserName        UserName,
    privDESKeyChange       KeyChange,
    privDESCloneFrom       RowPointer,
    privDESPublic          OCTET STRING,
    privDESStorageType     StorageType,
    privDESStatus          RowStatus
}

privDESEngineID  OBJECT-TYPE
    SYNTAX       SnmpEngineID
    MAX-ACCESS   not-accessible
    STATUS       current
    DESCRIPTION "An on whose
   behalf a message must be en/decrypted at a particular SNMPv3 engine,
   that engine must have knowledge of that user.  An SNMPv3 engine's administratively-unique identifier.

                 In a simple agent, this value is always engine that agent's
                 own snmpEngineID value.

                 This value can
   wishes to communicate with another SNMPv3 engine must also take the value have
   knowledge of a user known to that engine, including knowledge of the snmpEngineID
   applicable attributes of a remote SNMP engine with which this that user.

   A user can
                 communicate.
                "
    ::= { privDESTableEntry 1 }

privDESUserName  OBJECT-TYPE
    SYNTAX       UserName
    MAX-ACCESS   not-accessible
    STATUS       current
    DESCRIPTION "An and its attributes are defined as follows:

   <userName>
     An octet string representing the name of the user."
    ::= { privDESTableEntry 2 }

privDESKeyChange OBJECT-TYPE
    SYNTAX       KeyChange  -- typically (SIZE (0..32))
    MAX-ACCESS   read-create
    STATUS       current
    DESCRIPTION "An object, which when modified, causes the user.

   <privKey>
     A user's secret
                 privacy key to be used as input for messages sent on behalf of this
                 user to/from the engine identified by privDESEngineID,
                 to be modified via a one-way function. DES key and IV.

7.2.2.  EngineID

   The associated protocol is engineID value contained in an authenticated message specifies
   the usecDESPrivProtocol. authoritative SNMPv3 engine for that particular message.
   (see the definition of engineID in the SNMP Architecture document
   [SNMP-ARCH]).

   The associated secret user's (private) privacy key is normally different at
   each authoritative SNMPv3 engine and so the user's secret
                 privacy key.

                 When creating a new user, it snmpEngineID is an 'inconsistentName'
                 error for a set operation to refer used
   to this object
                 unless it is previously or concurrently initialized
                 through a set operation on select the corresponding value
                 of privDESCloneFrom.
                "
    DEFVAL      { ''H }    -- proper key for the empty string
    ::= { privDESTableEntry 3 }

privDESCloneFrom OBJECT-TYPE
    SYNTAX       RowPointer
    MAX-ACCESS   read-create
    STATUS       current
    DESCRIPTION "A pointer to another conceptual row in authentication process.

7.2.3.  SNMPv3 Messages Using this
                 privDESTable.  The user in Privacy Protocol

   Messages using this other conceptual row
                 is called the clone-from user.

                 When a new user is created (i.e., privacy protocol carry a new conceptual row
                 is instantiated in privParameters
   field as part of the securityParameters. For this table), protocol, the privacy parameters
   privParameters field is the serialized octet string representing
   the "salt" that was used to create the IV.

7.2.4  Input and Output of the new user are cloned from its clone-from user.

                 The first time DES Privacy Module

   This section describes the inputs and outputs that the DES Privacy
   module expects and produces when the User-based Security module
   invokes the DES Privacy module for services.

7.2.4.1  Input and Output when generating an instance SNMPv3 Message

   This DES privacy protocol assumes that the selection of this object the
   privKey is set done by a
                 management operation (either at or after its
                 instantiation), the cloning process is invoked.
                 Subsequent writes are successful but invoke no action caller and that the caller passes
   the secret key to be taken used. The abstract service interface is:

        encryptMsg(cryptKey, scopedPDU)

   Where:

        cryptKey
          The secret key to be used by the agent. encryption algorithm.
        scopedPDU
          The cloning process fails with data to be encrypted.

   Upon completion the privacy module returns information.
   The abstract service interface is:

        returnEncryptedMsg(encryptedPDU, privParameters, statusCode)
   Where:
        encryptedPDU
          The encrypted scopedPDU (encoded as an 'inconsistentName'
                 error if octet string).
        privParameters
          The privacy parameters (encoded as an octet string) that
          need to be sent in the conceptual row representing outgoing message.
        statusCode
          The indicator of whether the
                 clone-from user is not in an active state PDU was encrypted successfully
          and if not, it indicates what went wrong.

7.2.4.2  Input and Output when receiving an SNMPv3 Message

   This DES privacy protocol assumes that the
                 cloning process selection of the
   privKey is invoked.

                 Cloning also causes done by the initial values of caller and that the caller passes
   the secret
                 privacy key of to be used. The abstract service interface is:

         decryptMsg(cryptKey, privParameters, encryptedPDU)

   Where:

         cryptKey
           The secret key to be used by the new user decryption algorithm.
         privParameters
           The "salt" to be set used to calculate the same
                 value as IV.
         encryptedPDU
           the corresponding secret data to be decrypted

   Upon completion the privacy module returns information.
   The abstract service interface is:

         returnDecryptedMsg(scopedPDU, statusCode)

   Where:

         scopedPDU
           The decrypted scopedPDU.
         statusCode
           The indicator whether the message was successfully decrypted.

7.3  Elements of Procedure.

   This section describes the clone-from
                 user.

                 When this object is read, procedures for the zero length string is
                 returned.
                "
    ::= { privDESTableEntry 4 }

privDESPublic   OBJECT-TYPE
    SYNTAX      OCTET STRING (SIZE(1..32))
    MAX-ACCESS  read-create
    STATUS      current
    DESCRIPTION "A publicly-readable value which is written as DES privacy protocol.

7.3.1  Processing an Outgoing Message

   This section describes the procedure followed by an SNMPv3 engine
   whenever it must encrypt part of an outgoing message using the procedure for changing a user's
   imfPrivDESProtocol.

   1)  The secret key,
                 and later read (localized) cryptKey are used to determine whether the change of construct the secrets was effected.
                "
    DEFVAL      { ''H }     -- DES
       encryption key, the empty string
    ::= { privDESTableEntry 5 }

privDESStorageType OBJECT-TYPE
    SYNTAX       StorageType
    MAX-ACCESS   read-create
    STATUS       current
    DESCRIPTION "The storage type for this conceptual row.

                 Conceptual rows having "salt" and the value 'permanent' must allow
                 write-access at a minimum DES pre-IV (as described in
       7.1.1.1).

   2)  The authParameters field is set to privDESKeyChange and
                 privDESPublic.

                 Note that any user which employs privacy must allow
                 its secret the serialization according
       to be updated and thus an entry the rules in this
                 table cannot be 'readOnly'.
                "
    DEFVAL      { nonVolatile }
    ::= { privDESTableEntry 6 }

privDESStatus    OBJECT-TYPE
    SYNTAX       RowStatus
    MAX-ACCESS   read-create
    STATUS       current
    DESCRIPTION "The status of this conceptual row.  Until instances [RFC1906] of
                 all corresponding columns are appropriately configured, an octet string representing the value of
       the corresponding instance of "salt" string.

   2)  The scopedPDU is encrypted (as described in 7.1.1.2) and the
                 privDESStatus column
       encrypted data is 'notReady'.  In particular,
                 a value must have been written serialized according to the privDESCloneFrom
                 column.

                 For those columnar objects which permit write-access,
                 their value rules in [RFC1906]
       as an existing conceptual row can be
                 changed irrespective of octet string.

   3)  The the value of privDESStatus
                 for that row.
                "
    ::= { privDESTableEntry 7 }

privDESSecretSpinLock  OBJECT-TYPE
    SYNTAX       TestAndIncr
    MAX-ACCESS   read-write
    STATUS       current
    DESCRIPTION "An advisory lock used to allow several cooperating
                 SNMPv3 engines, all acting in serialized octet string representing the encrypted
       scopedPDU together with the privParameters and a manager role, to
                 coordinate their use statusCode of facilities
       success is returned to alter secrets
                 in the privDESTable.
                "
    ::= { privDESMIBObjects 3 }

-- Conformance Information *******************************************

privDESMIBCompliances
                 OBJECT IDENTIFIER ::= { privDESMIBConformance 1 }
privDESMIBGroups
                 OBJECT IDENTIFIER ::= { privDESMIBConformance 2 }

-- Compliance statements

privDESMIBCompliance MODULE-COMPLIANCE
    STATUS       current
    DESCRIPTION "The compliance statement for SNMPv3 engines which
                 implement caller.

7.3.2  Processing an Incoming Message

   This section describes the procedure followed by an SNMPv3 privDES MIB.
                "

    MODULE       -- this module
        MANDATORY-GROUPS { privDESMIBBasicGroup }

    ::= { privDESMIBCompliances 1 }

-- Units of compliance

privDESMIBBasicGroup OBJECT-GROUP
    OBJECTS     { privDESStatsUnknownUserNames,
                  privDESStatsUnknownEngineIDs,
                  privDESStatsDecryptionErrors,
                  privDESKeyChange,
                  privDESCloneFrom,
                  privDESPublic,
                  privDESStorageType,
                  privDESStatus,
                  privDESSecretSpinLock
                }
    STATUS       current
    DESCRIPTION "A collection of objects providing for configuration engine
   whenever it must decrypt part of an SNMPv3 entity which implements incoming message using the
   imfPrivDESProtocol.

   1)  If the privParameters field is not an 8-byte octet string,
       then an error indication (privacyError) is returned to the
       calling module.

   2)  The "salt" is extracted from the privParameters field.

   3)  The secret (localized) cryptKey and the "salt" are then used
       to construct the DES decryption key and pre-IV
       (as described in 7.1.1.1).

   4)  The encryptedPDU is decrypted (as described in 7.1.1.3).

   5)  If the encryptedPDU cannot be decrypted, then an error
       indication (privacyError) is returned to the SNMPv3
                 DES Privacy Protocol.
                "
    ::= { privDESMIBGroups 1 }

END calling module.

   6)  The decrypted scopedPDU and a statusCode of success are returned
       to the calling module.

8.  Editor's Addresses

   Co-editor   Uri Blumenthal
               IBM T. J. Watson Research
   postal:     30 Saw Mill River Pkwy,
               Hawthorne, NY 10532
               USA
   email:      uri@watson.ibm.com
   phone:      +1-914-784-7064

   Co-editor:  Bert Wijnen
               IBM T. J. Watson Research
   postal:     Schagen 33
               3461 GL Linschoten
               Netherlands
   email:      wijnen@vnet.ibm.com
   phone:      +31-348-432-794

9.  Acknowledgements

This document is based on the recommendations of the SNMP Security and
Administrative Framework Evolution team, comprised of

    David Harrington (Cabletron Systems Inc.)
    Jeff Johnson (Cisco)
    David Levi (SNMP Research Inc.)
    John Linn (Openvision)
    Russ Mundy (Trusted Information Systems) chair
    Shawn Routhier (Epilogue)
    Glenn Waters (Nortel)
    Bert Wijnen (IBM T. J. Watson Research)

Further a lot of "cut and paste" material comes from RFC1910 and from
earlier draft documents from the SNMPv2u and SNMPv2* series.

Further more a special thanks is due to the SNMPv3 WG, specifically:
    ....

10.  Security Considerations

10.1.  Recommended Practices

   This section describes practices that contribute to the secure,
   effective operation of the mechanisms defined in this memo.

   - A management station must discard SNMPv3 responses for which
     neither the msgID nor the request-id component or the represented
     management information corresponds to any currently outstanding
     request.

     Although it would be typical for a management station to do this
     as a matter of course, when using these security protocols it is
     significant due to the possibility of message duplication
     (malicious or otherwise).

   - A management station must generate unpredictable msgIDs and
     request-ids in authenticated messages in order to protect against
     the possibility of message duplication (malicious or otherwise).
     For example, start operations with msgID and/or request-id 0 is
     not a good idea. Initializing them with a pseudorandom number
     and then incrementing by one would be acceptable.

   - A management station should perform time synchronization using
     authenticated messages in order to protect against the possibility
     of message duplication (malicious or otherwise).

   - When sending state altering messages to a managed agent, a
     management station should delay sending successive messages to the
     managed agent until a positive acknowledgement is received for the
     previous message or until the previous message expires.

     No message ordering is imposed by the SNMPv3. Messages may be
     received in any order relative to their time of generation and
     each will be processed in the ordered received. Note that when an
     authenticated message is sent to a managed agent, it will be valid
     for a period of time of approximately 150 seconds under normal
     circumstances, and is subject to replay during this period.
     Indeed, a management station must cope with the loss and
     re-ordering of messages resulting from anomalies in the network
     as a matter of course.

     However, a managed object, snmpSetSerialNo [RFC1907], is
     specifically defined for use with SNMPv2 set operations in order
     to provide a mechanism to ensure the processing of SNMPv2 messages
     occurs in a specific order.

   - The frequency with which the secrets of an SNMPv3 user should be
     changed is indirectly related to the frequency of their use.

     Protecting the secrets from disclosure is critical to the overall
     security of the protocols. Frequent use of a secret provides a
     continued source of data that may be useful to a cryptanalyst in
     exploiting known or perceived weaknesses in an algorithm.
     Frequent changes to the secret avoid this vulnerability.

     Changing a secret after each use is generally regarded as the most
     secure practice, but a significant amount of overhead may be
     associated with that approach.

     Note, too, in a local environment the threat of disclosure may be
     less significant, and as such the changing of secrets may be less
     frequent.  However, when public data networks are the
     communication paths, more caution is prudent.

10.2  Defining Users

   The mechanisms defined in this document employ the notion of "users"
   which map into "groups" and such "groups" have access rights.
   How "users" are defined is subject to the security policy of the
   network administration. For example, users could be individuals
   (e.g., "joe" or "jane"), or a particular role (e.g., "operator" or
   "administrator"), or a combination (e.g., "joe-operator",
   "jane-operator" or "joe-admin").  Furthermore, a "user" may be a
   logical entity, such as a manager station application or set
   of manager station applications, acting on behalf of an individual
   or role, or set of individuals, or set of roles, including
   combinations.

   Appendix A describes an algorithm for mapping a user "password" to a
   16 octet value for use as either a user's authentication key or
   privacy key (or both).  Note however, that using the same password
   (and therefore the same key) for both authentication and privacy is
   very poor security practice and should be strongly discouraged.
   Passwords are often generated, remembered, and input by a human.
   Human-generated passwords may be less than the 16 octets required
   by the authentication and privacy protocols, and brute force
   attacks can be quite easy on a relatively short ASCII character set.
   Therefore, the algorithm is Appendix A performs a transformation on
   the password.  If the Appendix A algorithm is used, SNMP
   implementations (and SNMP configuration applications) must ensure
   that passwords are at least 8 characters in length.

   Because the Appendix A algorithm uses such passwords (nearly)
   directly, it is very important that they not be easily guessed.  It
   is suggested that they be composed of mixed-case alphanumeric and
   punctuation characters that don't form words or phrases that might
   be found in a dictionary.  Longer passwords improve the security of
   the system.  Users may wish to input multiword phrases to make their
   password string longer while ensuring that it is memorable.

   Since it is infeasible for human users to maintain different
   passwords for every engine, but security requirements strongly
   discourage having the same key for more than one engine, SNMPv3
   employs a compromise proposed in [Localized-key].
   It derives the user keys for the SNMPv3 engines from user's password
   in such a way that it is practically impossible to either determine
   the user's password, or user's key for another SNMPv3 engine from
   any combination of user's keys on SNMPv3 engines.

   Note however, that if user's password is disclosed, key localization
   will not help and network security may be compromised in this case.

10.3.  Conformance

   To be termed a "Secure SNMPv3 implementation" based on the User-base
   Security model, an SNMPv3 implementation:

   - must implement one or more Authentication Protocol(s). The MD5
     Authentication Protocol defined in this memo is one such protocol.

   - must, to the maximal maximum extent possible, prohibit access to the
     secret(s) of each user about which it maintains information in a
     Security
     Local (security) Configuration Database (SCD) (LCD) under all
     circumstances except as required to generate and/or validate
     SNMPv3 messages with respect to that user.

   - must implement these MIBs:
     - SNMPv3 USEC MIB.
     - the authentication MIB for the authentication protocol(s) in
       use. The SNMPv3 AUTH-MD5 MIB defined in this memo is one such SNMP USEC MIB.

   In addition, an authoritative SNMPv3 agent engine must provide initial
   configuration in accordance with Appendix A.1.

   Implementation of a Privacy Protocol (the Symmetric Encryption
   Protocol defined in this memo is one such protocol) and its related
   MIB (the SNMPv3 PRIV-DES MIB defined in this memo is one such MIB) is optional.

11.  References

[RFC1902] The SNMPv2 Working Group, Case, J., McCloghrie, K.,
     Rose, M., and S., Waldbusser, "Structure of Management
     Information for Version  2 of the Simple Network Management
     Protocol (SNMPv2)", RFC 1905, January 1996.

[RFC1905] The SNMPv2 Working Group, Case, J., McCloghrie, K.,
     Rose, M., and S., Waldbusser, "Protocol Operations for
     Version 2 of the Simple Network Management Protocol (SNMPv2)",
     RFC 1905, January 1996.

[RFC1906] The SNMPv2 Working Group, Case, J., McCloghrie, K.,
     Rose, M., and S. Waldbusser, "Transport Mappings for
     Version 2 of the Simple Network Management Protocol (SNMPv2)",
     RFC 1906, January 1996.

[RFC1907] The SNMPv2 Working Group, Case, J., McCloghrie, K.,
     Rose, M., and S. Waldbusser, "Management Information Base for
     Version 2 of the Simple Network Management Protocol (SNMPv2)",
     RFC 1907 January 1996.

[RFC1908] The SNMPv2 Working Group, Case, J., McCloghrie, K.,
     Rose, M., and S. Waldbusser, "Coexistence between Version 1
     and Version 2 of the Internet-standard Network Management
     Framework", RFC 1908, January 1996.

[SNMPng-ARCH]

[SNMP-ARCH] The SNMPv3 Working Group, Harrington, D., Wijnen, B.,
     "Architectural Model
     "An Architecture for the Next Generation Simple Network
     Managememt Protocol (SNMPng)",
     draft-ietf-snmpv3-next-gen-arch-00.txt,
     March describing Internet Management Frameworks",
     draft-ietf-snmpv3-next-gen-arch-02.txt, June 1997.

[SNMPv3-MPC] The SNMPv3 Working Group, Wijnen, B., Harrington, D.,
     "Message Processing and Control Model for version 3 of the Simple
     Network Management Protocol (SNMPv3)",
     draft-ietf-snmpv3-mpc-00.txt,
     March
     draft-ietf-snmpv3-mpc-01.txt, June 1997.

[SNMPv3-LPM]

[SNMPv3-ACM] The SNMPv3 Working Group, Wijnen, B., Harrington, D.,
     "Local Processing
     "Access Control Model for version Version 3 of the Simple Network
     Management Protocol (SNMPv3)",
     draft-ietf-snmpv3-lpm-00.txt,
     March draft-ietf-snmpv3-acm-00.txt,
     June 1997.

[SNMPv3-USEC] The SNMPv3 Working Group, Blumenthal, U., Wijnen, B.
     "User-Based Security Model for version 3 of the Simple Network
     Managememt
     Management Protocol (SNMPv3)",
     draft-ietf-snmpv3-usec-00.txt, April
     draft-ietf-snmpv3-usec-01.txt, June 1997.

[Localized-Key] U. Blumenthal, N. C. Hien, B. Wijnen
     "Key Derivation for Network Management Applications"
     IEEE Network Magazine, April/May issue, 1997.

[KEYED-MD5] Krawczyk, H.,
     "Keyed-MD5 for Message Authentication",
     Work in Progress, IBM, June 1995.

[MD5] Rivest, R.
     "Message Digest Algorithm MD5"
     RFC 1321.

[DES-NIST] Data Encryption Standard, National Institute of Standards
     and Technology.  Federal Information Processing Standard (FIPS)
     Publication 46-1.  Supersedes FIPS Publication 46, (January, 1977;
     reaffirmed January, 1988).

[DES-ANSI] Data Encryption Algorithm, American National Standards
     Institute.  ANSI X3.92-1981, (December, 1980).

[DESO-NIST] DES Modes of Operation, National Institute of Standards and
     Technology.  Federal Information Processing Standard (FIPS)
     Publication 81, (December, 1980).

[DESO-ANSI] Data Encryption Algorithm - Modes of Operation, American
     National Standards Institute.  ANSI X3.106-1983, (May 1983).

[DESG-NIST] Guidelines for Implementing and Using the NBS Data
     Encryption Standard, National Institute of Standards and
     Technology.  Federal Information Processing Standard (FIPS)
     Publication 74, (April, 1981).

[DEST-NIST] Validating the Correctness of Hardware Implementations of
     the NBS Data Encryption Standard, National Institute of Standards
     and Technology.  Special Publication 500-20.

[DESM-NIST] Maintenance Testing for the Data Encryption Standard,
     National Institute of Standards and Technology.
     Special Publication 500-61, (August, 1980).

APPENDIX A - Installation

A.1.   Engine Installation Parameters

During installation, an SNMPv3 engine acting in an authoritative role
is configured with several parameters.  These include:

(1) one or more secrets

    These are the authentication/privacy secrets for the first user
    to be configured.

    One way to accomplish this is to have the installer enter a
    "password" for each required secret. The password is then
    algorithmically converted into the required secret by:

    - forming a string of length 1,048,576 octets by repeating the
      value of the password as often as necessary, truncating
      accordingly, and using the resulting string as the input to
      the MD5 algorithm [MD5].  The resulting digest, termed "digest1",
      is used in the next step.

    - a second string of length 44 octets is formed by concatenating
      digest1, the SNMPv3 engine's snmpEngineID value, and digest1.
      This string is used as input to the MD5 algorithm [MD5].

      The resulting digest is the required secret (see Appendix A.2).

    With these configured parameters, the SNMPv3 engine instantiates
    the following usecUserEntry in the usecUserTable:

                              no privacy support  privacy support
                              ------------------  ---------------
      usecUserEngineID        localEngineID       localEngineID
      usecUserName            "public"            "public"
      usecUserMiId            "public"            "public"
      usecUserGroupName       "public"            "public"
      usecUserCloseFrom       ZeroDotZero         ZeroDotZero
      usecUserAuthProtocol    usecMD5AuthProtocol usecMD5AuthProtocol    imfAuthMD5Protocol  imfAuthMD5Protocol
      usecUserAuthKeyChange   ""                  ""
      usecUserAuthPublic      ""                  ""
      usecUserPrivProtocol    none                usecDESPrivProtocol
      usecUserStorageType     permanent           permanent
      usecUserSecurityCookie  <upToImplemeter>    <upToImplementer>
      usecUserStatus          active              active

    With these configured parameters, the SNMPv3 engine instantiates
    the following authMD5TableEntry in the authMD5Table:

                              no privacy support  privacy support
                              ------------------  ---------------
      authMD5EngineID         localEngineID       localEngineID
      authMD5UserName         "public"            "public"
      authMD5KeyChange                imfPrivDESProtocol
      usecUserPrivKeyChange   ""                  ""
      authMD5CloneFrom        ZeroDotZero         ZeroDotZero
      authMD5Public
      usecUserrivhPublic      ""                  ""
      authMD5StorageType
      usecUserStorageType     permanent           permanent
      authMD5Status           active
      usecUserStatus          active

    With these configured parameters, the SNMPv3 engine instantiates
    the following authMD5TableEntry in the authMD5Table:

                              no privacy support  privacy support
                              ------------------  ---------------
      authMD5EngineID                             localEngineID
      authMD5UserName                             "public"
      authMD5KeyChange                            ""
      authMD5CloneFrom                            ZeroDotZero
      authMD5Public                               ""
      authMD5StorageType                          permanent
      authMD5Status              active

A.2.   Password to Key Algorithm

The following code fragment demonstrates the password to key
algorithm which can be used when mapping a password to an
authentication or privacy key. The calls to MD5 are as
documented in RFC1321 [RFC1321]

void password_to_key(
   u_char *password,    /* IN */
   u_int   passwordlen, /* IN */
   u_char *agentID, *engineID,    /* IN  - ptr to 12 octet long snmpEngineID  */
   u_char *key)         /* OUT - caller's pointer to 16-byte buffer */
{
   MD5_CTX     MD;
   u_char     *cp, password_buf[64];
   u_long      password_index = 0;
   u_long      count = 0, i;

   MD5Init (&MD);   /* initialize MD5 */

   /**********************************************/
   /* Use while loop until we've done 1 Megabyte */
   /**********************************************/
   while (count < 1048576) {
      cp = password_buf;
      for (i = 0; i < 64; i++) {
          /*************************************************/
          /* Take the next byte of the password, wrapping  */
          /* to the beginning of the password as necessary.*/
          /*************************************************/
          *cp++ = password[password_index++ % passwordlen];
      }
      MDupdate (&MD, password_buf, 64);
      count += 64;
   }
   MD5Final (key, &MD);          /* tell MD5 we're done */

   /*****************************************************/
   /* Now localize the key with the agentID engineID and pass   */
   /* through MD5 to produce final key                  */
   /*****************************************************/
   memcpy(password_buf, key, 16);
   memcpy(password_buf+16, agentID, engineID, 12);
   memcpy(password_buf+28, key, 16);

   MD5Init(&MD);
   MDupdate(&MD, password_buf, 44);
   MD5Final(key, &MD);

   return;
}

A.3.   Password to Key Sample

   The following shows a sample output of the password to key algorithm.

   With a password of "maplesyrup" the output of the password to key
   algorithm before the key is localized with the engine's engineID is:

      '9f af 32 83 88 4e 92 83 4e bc 98 47 d8 ed d9 63'H

   After the intermediate key (shown above) is localized with the
   snmpEngineID value of:

      '00 00 00 00 00 00 00 00 00 00 00 02'H

   the final output of the password to key algorithm is:

      '52 6f 5e ed 9f cc e2 6f 89 64 c2 93 07 87 d8 2b'H

Table of Contents

0.

0.1 Issues                                                             1
0.2 Change Log                                                         2
1.  Introduction                                                       3
1.1.  Threats                                                          3
1.2.  Goals and Constraints                                            4
1.3.  Security Services                                                5
1.4.  Implementation Organization                                      6
1.4.1.  Timeliness Module                                              6
1.4.2.  Authentication Protocol                                        6
1.4.3.  Privacy Protocol                                               7
1.5  Mechanisms to protect  Protection against Message Replay, Delay and Redirection          7
1.5.1   Authoritative SNMP Engine                                      7
1.5.2   The following mechanisms are used:                             7
   1.5.1).  On receipt of a message, an authoritative engine checks the  8
2.  Elements of the Model                                             10
2.1.  SNMPv3 Users                                                    10
2.2.  Replay Protection                                               10                                               11
2.2.1.  snmpEngineID                                                  11
2.2.2.  engineBoots and engineTime                                    11
   2.4
   2.3 for (re-)synchronization procedures).  Note, however, that the 11 12
2.2.3.  Time Window                                                   12
2.3.  Error Reporting                                                 12
2.4.  Time Synchronization                                            12
2.5.
2.4.  SNMPv3 Messages Using this Model                                13
2.6
2.5  Input and Output of the User-based Security Module               13
2.6.1               14
2.5.1 Input and Output when generating an SNMPv3 Message              14
2.6.1
2.5.2 Input and Output when receiving an SNMPv3 Message               14               15
3.  Elements of Procedure                                             17                                             18
3.1.  Processing an Outgoing Message                                  17                                  18
3.2.  Processing an Incoming Message                                  19
       2.5,                                  20
       2.4, then the snmpInASNParseErrs counter [RFC1907] is          19          20
4.  Discovery                                                         24                                                         25
5.  Definitions                                                       25                                                       26
6.  MD5 Authentication Protocol                                       33                                       36
6.1  Mechanisms                                                       33                                                       36
6.1.1.  Digest Authentication Protocol                                33                                36
6.2  Elements of the Digest Authentication Protocol                   34                   37
6.2.1.  SNMPv3 Users                                                  34                                                  37
6.2.2.  EngineID                                                      34                                                      37
6.2.3.  SNMPv3 Messages Using this Authentication Protocol            34            37
6.2.4  Input and Output of the MD5 Authentication Module              35              37
6.2.4.1  Input and Output when generating an SNMPv3 Message           35           38
6.2.4.2  Input and Output when receiving an SNMPv3 Message            35            38
6.3  Elements of Procedure                                            36                                            39
6.3.1  Processing an Outgoing Message                                 36                                 39
6.3.2  Processing an Incoming Message                                 36
6.4  Definitions                                                      38                                 39
7.  DES Privacy Protocol                                              46                                              41
7.1  Mechanisms                                                       46                                                       41
7.1.1.  Symmetric Encryption Protocol                                 46                                 41
7.1.1.1  DES key and Initialization Vector.                           47                           42
7.1.1.2  Data Encryption.                                             47                                             42
7.1.1.3  Data Decryption                                              48                                              43
7.2  Elements of the DES Privacy Protocol                             48                             43
7.2.1.  SNMPv3 Users                                                  48                                                  43
7.2.2.  EngineID                                                      48                                                      44
7.2.3.  SNMPv3 Messages Using this Privacy Protocol                   49                   44
7.2.4  Input and Output of the DES Privacy Module                     49                     44
7.2.4.1  Input and Output when generating an SNMPv3 Message           49           44
7.2.4.2  Input and Output when receiving an SNMPv3 Message            49            45
7.3  Elements of Procedure.                                           50                                           45
7.3.1  Processing an Outgoing Message                                 50                                 45
       7.1.1.1).                                                      45
7.3.2  Processing an Incoming Message                                 51
7.4  Definitions                                                      53                                 46
8.  Editor's Addresses                                                59                                                47
9.  Acknowledgements                                                  59                                                  47
A.1.   Engine Installation Parameters                                 65                                 53
A.2.   Password to Key Algorithm                                      67                                      54
A.3.   Password to Key Sample                                         68                                         55