home *** CD-ROM | disk | FTP | other *** search
/ The Hacker's Encyclopedia 1998 / hackers_encyclopedia.iso / rfc / 3 / rfc2264.txt < prev    next >
Encoding:
Text File  |  2003-06-11  |  164.8 KB  |  4,260 lines

  1.  
  2.  
  3.  
  4.  
  5.  
  6.  
  7. Network Working Group                                      U. Blumenthal
  8. Request for Comments: 2264                     IBM T. J. Watson Research
  9. Category: Standards Track                                      B. Wijnen
  10.                                                IBM T. J. Watson Research
  11.                                                             January 1998
  12.  
  13.  
  14.           User-based Security Model (USM) for version 3 of the
  15.               Simple Network Management Protocol (SNMPv3)
  16.  
  17. Status of this Memo
  18.  
  19.    This document specifies an Internet standards track protocol for the
  20.    Internet community, and requests discussion and suggestions for
  21.    improvements.  Please refer to the current edition of the "Internet
  22.    Official Protocol Standards" (STD 1) for the standardization state
  23.    and status of this protocol.  Distribution of this memo is unlimited.
  24.  
  25. Copyright Notice
  26.  
  27.    Copyright (C) The Internet Society (1997).  All Rights Reserved.
  28.  
  29. Abstract
  30.  
  31.    This document describes the User-based Security Model (USM) for SNMP
  32.    version 3 for use in the SNMP architecture [RFC2261].  It defines the
  33.    Elements of Procedure for providing SNMP message level security.
  34.    This document also includes a MIB for remotely monitoring/managing
  35.    the configuration parameters for this Security Model.
  36.  
  37. Table of Contents
  38.  
  39. 1.  Introduction                                                       3
  40. 1.1.  Threats                                                          4
  41. 1.2.  Goals and Constraints                                            5
  42. 1.3.  Security Services                                                6
  43. 1.4.  Module Organization                                              7
  44. 1.4.1.  Timeliness Module                                              7
  45. 1.4.2.  Authentication Protocol                                        8
  46. 1.4.3.  Privacy Protocol                                               8
  47. 1.5.  Protection against Message Replay, Delay and Redirection         8
  48. 1.5.1.  Authoritative SNMP engine                                      8
  49. 1.5.2.  Mechanisms                                                     8
  50. 1.6.  Abstract Service Interfaces.                                    10
  51. 1.6.1.  User-based Security Model Primitives for Authentication       11
  52. 1.6.2.  User-based Security Model Primitives for Privacy              11
  53. 2.  Elements of the Model                                             12
  54. 2.1.  User-based Security Model Users                                 12
  55.  
  56.  
  57.  
  58. Blumenthal & Wijnen         Standards Track                     [Page 1]
  59.  
  60. RFC 2264                     USM for SNMPv3                 January 1998
  61.  
  62.  
  63. 2.2.  Replay Protection                                               13
  64. 2.2.1.  msgAuthoritativeEngineID                                      13
  65. 2.2.2.  msgAuthoritativeEngineBoots and msgAuthoritativeEngineTime    14
  66. 2.2.3.  Time Window                                                   15
  67. 2.3.  Time Synchronization                                            15
  68. 2.4.  SNMP Messages Using this Security Model                         16
  69. 2.5.  Services provided by the User-based Security Model              17
  70. 2.5.1.  Services for Generating an Outgoing SNMP Message              17
  71. 2.5.2.  Services for Processing an Incoming SNMP Message              19
  72. 2.6.  Key Localization Algorithm.                                     21
  73. 3.  Elements of Procedure                                             21
  74. 3.1.  Generating an Outgoing SNMP Message                             22
  75. 3.2.  Processing an Incoming SNMP Message                             25
  76. 4.  Discovery                                                         30
  77. 5.  Definitions                                                       31
  78. 6.  HMAC-MD5-96 Authentication Protocol                               45
  79. 6.1.  Mechanisms                                                      45
  80. 6.1.1.  Digest Authentication Mechanism                               46
  81. 6.2.  Elements of the Digest Authentication Protocol                  46
  82. 6.2.1.  Users                                                         46
  83. 6.2.2.  msgAuthoritativeEngineID                                      47
  84. 6.2.3.  SNMP Messages Using this Authentication Protocol              47
  85. 6.2.4.  Services provided by the HMAC-MD5-96 Authentication Module    47
  86. 6.2.4.1.  Services for Generating an Outgoing SNMP Message            47
  87. 6.2.4.2.  Services for Processing an Incoming SNMP Message            48
  88. 6.3.  Elements of Procedure                                           49
  89. 6.3.1.  Processing an Outgoing Message                                49
  90. 6.3.2.  Processing an Incoming Message                                50
  91. 7.  HMAC-SHA-96 Authentication Protocol                               51
  92. 7.1.  Mechanisms                                                      51
  93. 7.1.1.  Digest Authentication Mechanism                               51
  94. 7.2.  Elements of the HMAC-SHA-96 Authentication Protocol             52
  95. 7.2.1.  Users                                                         52
  96. 7.2.2.  msgAuthoritativeEngineID                                      52
  97. 7.2.3.  SNMP Messages Using this Authentication Protocol              53
  98. 7.2.4.  Services provided by the HMAC-SHA-96 Authentication Module    53
  99. 7.2.4.1.  Services for Generating an Outgoing SNMP Message            53
  100. 7.2.4.2.  Services for Processing an Incoming SNMP Message            54
  101. 7.3.  Elements of Procedure                                           54
  102. 7.3.1.  Processing an Outgoing Message                                55
  103. 7.3.2.  Processing an Incoming Message                                55
  104. 8.  CBC-DES Symmetric Encryption Protocol                             56
  105. 8.1.  Mechanisms                                                      56
  106. 8.1.1.  Symmetric Encryption Protocol                                 57
  107. 8.1.1.1.  DES key and Initialization Vector.                          57
  108. 8.1.1.2.  Data Encryption.                                            58
  109. 8.1.1.3.  Data Decryption                                             59
  110. 8.2.  Elements of the DES Privacy Protocol                            59
  111.  
  112.  
  113.  
  114. Blumenthal & Wijnen         Standards Track                     [Page 2]
  115.  
  116. RFC 2264                     USM for SNMPv3                 January 1998
  117.  
  118.  
  119. 8.2.1.  Users                                                         59
  120. 8.2.2.  msgAuthoritativeEngineID                                      59
  121. 8.2.3.  SNMP Messages Using this Privacy Protocol                     60
  122. 8.2.4.  Services provided by the DES Privacy Module                   60
  123. 8.2.4.1.  Services for Encrypting Outgoing Data                       60
  124. 8.2.4.2.  Services for Decrypting Incoming Data                       61
  125. 8.3.  Elements of Procedure.                                          61
  126. 8.3.1.  Processing an Outgoing Message                                61
  127. 8.3.2.  Processing an Incoming Message                                62
  128. 9.  Intellectual Property                                             62
  129. 10. Acknowledgements                                                  63
  130. 11. Security Considerations                                           64
  131. 11.1. Recommended Practices                                           64
  132. 11.2. Defining Users                                                  66
  133. 11.3. Conformance                                                     67
  134. 12. References                                                        67
  135. 13. Editors' Addresses                                                69
  136. A.1.  SNMP engine Installation Parameters                             70
  137. A.2.  Password to Key Algorithm                                       71
  138. A.2.1.  Password to Key Sample Code for MD5                           71
  139. A.2.2.  Password to Key Sample Code for SHA                           72
  140. A.3.  Password to Key Sample Results                                  73
  141. A.3.1.  Password to Key Sample Results using MD5                      73
  142. A.3.2.  Password to Key Sample Results using SHA                      74
  143. A.4.  Sample encoding of msgSecurityParameters                        74
  144. B.  Full Copyright Statement                                          76
  145.  
  146. 1.  Introduction
  147.  
  148.    The Architecture for describing Internet Management Frameworks
  149.    [RFC2261] describes that an SNMP engine is composed of:
  150.  
  151.      1) a Dispatcher
  152.      2) a Message Processing Subsystem,
  153.      3) a Security Subsystem, and
  154.      4) an Access Control Subsystem.
  155.  
  156.    Applications make use of the services of these subsystems.
  157.  
  158.    It is important to understand the SNMP architecture and the
  159.    terminology of the architecture to understand where the Security
  160.    Model described in this document fits into the architecture and
  161.    interacts with other subsystems within the architecture.  The reader
  162.    is expected to have read and understood the description of the SNMP
  163.    architecture, as defined in [RFC2261].
  164.  
  165.  
  166.  
  167.  
  168.  
  169.  
  170. Blumenthal & Wijnen         Standards Track                     [Page 3]
  171.  
  172. RFC 2264                     USM for SNMPv3                 January 1998
  173.  
  174.  
  175.    This memo [RFC2264] describes the User-based Security Model as it is
  176.    used within the SNMP Architecture.  The main idea is that we use the
  177.    traditional concept of a user (identified by a userName) with which
  178.    to associate security information.
  179.  
  180.    This memo describes the use of HMAC-MD5-96 and HMAC-SHA-96 as the
  181.    authentication protocols and the use of CBC-DES as the privacy
  182.    protocol. The User-based Security Model however allows for other such
  183.    protocols to be used instead of or concurrent with these protocols.
  184.    Therefore, the description of HMAC-MD5-96, HMAC-SHA-96 and CBC-DES
  185.    are in separate sections to reflect their self-contained nature and
  186.    to indicate that they can be replaced or supplemented in the future.
  187.  
  188.    The key words "MUST", "MUST NOT", "REQUIRED", "SHALL", "SHALL NOT",
  189.    "SHOULD", "SHOULD NOT", "RECOMMENDED",  "MAY", and "OPTIONAL" in this
  190.    document are to be interpreted as described in [RFC2119].
  191.  
  192. 1.1.  Threats
  193.  
  194.    Several of the classical threats to network protocols are applicable
  195.    to the network management problem and therefore would be applicable
  196.    to any SNMP Security Model.  Other threats are not applicable to the
  197.    network management problem.  This section discusses principal
  198.    threats, secondary threats, and threats which are of lesser
  199.    importance.
  200.  
  201.    The principal threats against which this SNMP Security Model should
  202.    provide protection are:
  203.  
  204.    - Modification of Information
  205.      The modification threat is the danger that some unauthorized entity
  206.      may alter in-transit SNMP messages generated on behalf of an
  207.      authorized user in such a way as to effect unauthorized management
  208.      operations, including falsifying the value of an object.
  209.  
  210.    - Masquerade
  211.      The masquerade threat is the danger that management operations not
  212.      authorized for some user may be attempted by assuming the identity
  213.      of another user that has the appropriate authorizations.
  214.  
  215.    Two secondary threats are also identified.  The Security Model
  216.    defined in this memo provides limited protection against:
  217.  
  218.    - Disclosure
  219.      The disclosure threat is the danger of eavesdropping on the
  220.      exchanges between managed agents and a management station.
  221.      Protecting against this threat may be required as a matter of local
  222.      policy.
  223.  
  224.  
  225.  
  226. Blumenthal & Wijnen         Standards Track                     [Page 4]
  227.  
  228. RFC 2264                     USM for SNMPv3                 January 1998
  229.  
  230.  
  231.    - Message Stream Modification
  232.      The SNMP protocol is typically based upon a connection-less
  233.      transport service which may operate over any sub-network service.
  234.      The re-ordering, delay or replay of messages can and does occur
  235.      through the natural operation of many such sub-network services.
  236.      The message stream modification threat is the danger that messages
  237.      may be maliciously re-ordered, delayed or replayed to an extent
  238.      which is greater than can occur through the natural operation of a
  239.      sub-network service, in order to effect unauthorized management
  240.      operations.
  241.  
  242.    There are at least two threats that an SNMP Security Model need not
  243.    protect against.  The security protocols defined in this memo do not
  244.    provide protection against:
  245.  
  246.    - Denial of Service
  247.      This SNMP Security Model does not attempt to address the broad
  248.      range of attacks by which service on behalf of authorized users is
  249.      denied.  Indeed, such denial-of-service attacks are in many cases
  250.      indistinguishable from the type of network failures with which any
  251.      viable network management protocol must cope as a matter of course.
  252.    - Traffic Analysis
  253.      This SNMP Security Model does not attempt to address traffic
  254.      analysis attacks.  Indeed, many traffic patterns are predictable -
  255.      devices may be managed on a regular basis by a relatively small
  256.      number of management applications - and therefore there is no
  257.      significant advantage afforded by protecting against traffic
  258.      analysis.
  259.  
  260. 1.2.  Goals and Constraints
  261.  
  262.    Based on the foregoing account of threats in the SNMP network
  263.    management environment, the goals of this SNMP Security Model are as
  264.    follows.
  265.  
  266.    1) Provide for verification that each received SNMP message has
  267.       not been modified during its transmission through the network.
  268.  
  269.    2) Provide for verification of the identity of the user on whose
  270.       behalf a received SNMP message claims to have been generated.
  271.  
  272.    3) Provide for detection of received SNMP messages, which request
  273.       or contain management information, whose time of generation was
  274.       not recent.
  275.  
  276.    4) Provide, when necessary, that the contents of each received
  277.       SNMP message are protected from disclosure.
  278.  
  279.  
  280.  
  281.  
  282. Blumenthal & Wijnen         Standards Track                     [Page 5]
  283.  
  284. RFC 2264                     USM for SNMPv3                 January 1998
  285.  
  286.  
  287.    In addition to the principal goal of supporting secure network
  288.    management, the design of this SNMP Security Model is also influenced
  289.    by the following constraints:
  290.  
  291.    1) When the requirements of effective management in times of
  292.       network stress are inconsistent with those of security, the design
  293.       should prefer the former.
  294.  
  295.    2) Neither the security protocol nor its underlying security
  296.       mechanisms should depend upon the ready availability of other
  297.       network services (e.g., Network Time Protocol (NTP) or key
  298.       management protocols).
  299.  
  300.    3) A security mechanism should entail no changes to the basic
  301.       SNMP network management philosophy.
  302.  
  303. 1.3.  Security Services
  304.  
  305.    The security services necessary to support the goals of this SNMP
  306.    Security Model are as follows:
  307.  
  308.    - Data Integrity
  309.      is the provision of the property that data has not been altered or
  310.      destroyed in an unauthorized manner, nor have data sequences been
  311.      altered to an extent greater than can occur non-maliciously.
  312.  
  313.    - Data Origin Authentication
  314.      is the provision of the property that the claimed identity of the
  315.      user on whose behalf received data was originated is corroborated.
  316.  
  317.    - Data Confidentiality
  318.      is the provision of the property that information is not made
  319.      available or disclosed to unauthorized individuals, entities, or
  320.      processes.
  321.  
  322.    - Message timeliness and limited replay protection
  323.      is the provision of the property that a message whose generation
  324.      time is outside of a specified time window is not accepted.  Note
  325.      that message reordering is not dealt with and can occur in normal
  326.      conditions too.
  327.  
  328.    For the protocols specified in this memo, it is not possible to
  329.    assure the specific originator of a received SNMP message; rather, it
  330.    is the user on whose behalf the message was originated that is
  331.    authenticated.
  332.  
  333.  
  334.  
  335.  
  336.  
  337.  
  338. Blumenthal & Wijnen         Standards Track                     [Page 6]
  339.  
  340. RFC 2264                     USM for SNMPv3                 January 1998
  341.  
  342.  
  343.    For these protocols, it not possible to obtain data integrity without
  344.    data origin authentication, nor is it possible to obtain data origin
  345.    authentication without data integrity.  Further, there is no
  346.    provision for data confidentiality without both data integrity and
  347.    data origin authentication.
  348.  
  349.    The security protocols used in this memo are considered acceptably
  350.    secure at the time of writing.  However, the procedures allow for new
  351.    authentication and privacy methods to be specified at a future time
  352.    if the need arises.
  353.  
  354. 1.4.  Module Organization
  355.  
  356.    The security protocols defined in this memo are split in three
  357.    different modules and each has its specific responsibilities such
  358.    that together they realize the goals and security services described
  359.    above:
  360.  
  361.    - The authentication module MUST provide for:
  362.  
  363.      - Data Integrity,
  364.  
  365.      - Data Origin Authentication
  366.  
  367.    - The timeliness module MUST provide for:
  368.  
  369.      - Protection against message delay or replay (to an extent
  370.        greater than can occur through normal operation)
  371.  
  372.      The privacy module MUST provide for
  373.  
  374.      - Protection against disclosure of the message payload.
  375.  
  376.    The timeliness module is fixed for the User-based Security Model
  377.    while there is provision for multiple authentication and/or privacy
  378.    modules, each of which implements a specific authentication or
  379.    privacy protocol respectively.
  380.  
  381. 1.4.1.  Timeliness Module
  382.  
  383.    Section 3 (Elements of Procedure) uses the timeliness values in an
  384.    SNMP message to do timeliness checking.  The timeliness check is only
  385.    performed if authentication is applied to the message.  Since the
  386.    complete message is checked for integrity, we can assume that the
  387.    timeliness values in a message that passes the authentication module
  388.    are trustworthy.
  389.  
  390.  
  391.  
  392.  
  393.  
  394. Blumenthal & Wijnen         Standards Track                     [Page 7]
  395.  
  396. RFC 2264                     USM for SNMPv3                 January 1998
  397.  
  398.  
  399. 1.4.2.  Authentication Protocol
  400.  
  401.    Section 6 describes the HMAC-MD5-96 authentication protocol which is
  402.    the first authentication protocol that MUST be supported with the
  403.    User-based Security Model.  Section 7 describes the HMAC-SHA-96
  404.    authentication protocol which is another authentication protocol that
  405.    SHOULD be supported with the User-based Security Model.  In the
  406.    future additional or replacement authentication protocols may be
  407.    defined as new needs arise.
  408.  
  409.    The User-based Security Model prescribes that, if authentication is
  410.    used, then the complete message is checked for integrity in the
  411.    authentication module.
  412.  
  413.    For a message to be authenticated, it needs to pass authentication
  414.    check by the authentication module and the timeliness check which is
  415.    a fixed part of this User-based Security model.
  416.  
  417. 1.4.3.  Privacy Protocol
  418.  
  419.    Section 8 describes the CBC-DES Symmetric Encryption Protocol which
  420.    is the first privacy protocol to be used with the User-based Security
  421.    Model.  In the future additional or replacement privacy protocols may
  422.    be defined as new needs arise.
  423.  
  424.    The User-based Security Model prescribes that the scopedPDU is
  425.    protected from disclosure when a message is sent with privacy.
  426.  
  427.    The User-based Security Model also prescribes that a message needs to
  428.    be authenticated if privacy is in use.
  429.  
  430. 1.5.  Protection against Message Replay, Delay and Redirection
  431.  
  432. 1.5.1.  Authoritative SNMP engine
  433.  
  434.    In order to protect against message replay, delay and redirection,
  435.    one of the SNMP engines involved in each communication is designated
  436.    to be the authoritative SNMP engine.  When an SNMP message contains a
  437.    payload which expects a response (for example a Get, GetNext,
  438.    GetBulk, Set or Inform PDU), then the receiver of such messages is
  439.    authoritative.  When an SNMP message contains a payload which does
  440.    not expect a response (for example an SNMPv2-Trap, Response or Report
  441.    PDU), then the sender of such a message is authoritative.
  442.  
  443. 1.5.2.  Mechanisms
  444.  
  445.    The following mechanisms are used:
  446.  
  447.  
  448.  
  449.  
  450. Blumenthal & Wijnen         Standards Track                     [Page 8]
  451.  
  452. RFC 2264                     USM for SNMPv3                 January 1998
  453.  
  454.  
  455.    1) To protect against the threat of message delay or replay (to an
  456.       extent greater than can occur through normal operation), a set of
  457.       timeliness indicators (for the authoritative SNMP engine) are
  458.       included in each message generated.  An SNMP engine evaluates the
  459.       timeliness indicators to determine if a received message is
  460.       recent.  An SNMP engine may evaluate the timeliness indicators to
  461.       ensure that a received message is at least as recent as the last
  462.       message it received from the same source.  A non-authoritative
  463.       SNMP engine uses received authentic messages to advance its notion
  464.       of the timeliness indicators at the remote authoritative source.
  465.  
  466.       An SNMP engine MUST also use a mechanism to match incoming
  467.       Responses to outstanding Requests and it MUST drop any Responses
  468.       that do not match an outstanding request. For example, a msgID can
  469.       be inserted in every message to cater for this functionality.
  470.  
  471.       These mechanisms provide for the detection of authenticated
  472.       messages whose time of generation was not recent.
  473.  
  474.       This protection against the threat of message delay or replay does
  475.       not imply nor provide any protection against unauthorized deletion
  476.       or suppression of messages.  Also, an SNMP engine may not be able
  477.       to detect message reordering if all the messages involved are sent
  478.       within the Time Window interval.  Other mechanisms defined
  479.       independently of the security protocol can also be used to detect
  480.       the re-ordering replay, deletion, or suppression of messages
  481.       containing Set operations (e.g., the MIB variable snmpSetSerialNo
  482.       [RFC1907]).
  483.  
  484.    2) Verification that a message sent to/from one authoritative SNMP
  485.       engine cannot be replayed to/as-if-from another authoritative SNMP
  486.       engine.
  487.  
  488.       Included in each message is an identifier unique to the
  489.       authoritative SNMP engine associated with the sender or intended
  490.       recipient of the message.
  491.  
  492.       A Report, Response or Trap message sent by an authoritative SNMP
  493.       engine to one non-authoritative SNMP engine can potentially be
  494.       replayed to another non-authoritative SNMP engine. The latter
  495.       non-authoritative SNMP engine might (if it knows about the same
  496.       userName with the same secrets at the authoritative SNMP engine)
  497.       as a result update its notion of timeliness indicators of the
  498.       authoritative SNMP engine, but that is not considered a threat.
  499.       In this case, A Report or Response message will be discarded by
  500.       the Message Processing Model, because there should not be an
  501.       outstanding Request message. A Trap will possibly be accepted.
  502.       Again, that is not considered a threat, because the communication
  503.  
  504.  
  505.  
  506. Blumenthal & Wijnen         Standards Track                     [Page 9]
  507.  
  508. RFC 2264                     USM for SNMPv3                 January 1998
  509.  
  510.  
  511.       was authenticated and timely. It is as if the authoritative SNMP
  512.       engine was configured to start sending Traps to the second SNMP
  513.       engine, which theoretically can happen without the knowledge of
  514.       the second SNMP engine anyway. Anyway, the second SNMP engine may
  515.       not expect to receive this Trap, but is allowed to see the
  516.       management information contained in it.
  517.  
  518.    3) Detection of messages which were not recently generated.
  519.  
  520.       A set of time indicators are included in the message, indicating
  521.       the time of generation.  Messages without recent time indicators
  522.       are not considered authentic.  In addition, an SNMP engine MUST
  523.       drop any Responses that do not match an outstanding request. This
  524.       however is the responsibility of the Message Processing Model.
  525.  
  526.    This memo allows the same user to be defined on multiple SNMP
  527.    engines.  Each SNMP engine maintains a value, snmpEngineID, which
  528.    uniquely identifies the SNMP engine.  This value is included in each
  529.    message sent to/from the SNMP engine that is authoritative (see
  530.    section 1.5.1).  On receipt of a message, an authoritative SNMP
  531.    engine checks the value to ensure that it is the intended recipient,
  532.    and a non-authoritative SNMP engine uses the value to ensure that the
  533.    message is processed using the correct state information.
  534.  
  535.    Each SNMP engine maintains two values, snmpEngineBoots and
  536.    snmpEngineTime, which taken together provide an indication of time at
  537.    that SNMP engine.  Both of these values are included in an
  538.    authenticated message sent to/received from that SNMP engine.  On
  539.    receipt, the values are checked to ensure that the indicated
  540.    timeliness value is within a Time Window of the current time.  The
  541.    Time Window represents an administrative upper bound on acceptable
  542.    delivery delay for protocol messages.
  543.  
  544.    For an SNMP engine to generate a message which an authoritative SNMP
  545.    engine will accept as authentic, and to verify that a message
  546.    received from that authoritative SNMP engine is authentic, such an
  547.    SNMP engine must first achieve timeliness synchronization with the
  548.    authoritative SNMP engine. See section 2.3.
  549.  
  550. 1.6.  Abstract Service Interfaces.
  551.  
  552.    Abstract service interfaces have been defined to describe the
  553.    conceptual interfaces between the various subsystems within an SNMP
  554.    entity. Similarly a set of abstract service interfaces have been
  555.    defined within the User-based Security Model (USM) to describe the
  556.    conceptual interfaces between the generic USM services and the self-
  557.    contained authentication and privacy services.
  558.  
  559.  
  560.  
  561.  
  562. Blumenthal & Wijnen         Standards Track                    [Page 10]
  563.  
  564. RFC 2264                     USM for SNMPv3                 January 1998
  565.  
  566.  
  567.    These abstract service interfaces are defined by a set of primitives
  568.    that define the services provided and the abstract data elements that
  569.    must be passed when the services are invoked. This section lists the
  570.    primitives that have been defined for the User-based Security Model.
  571.  
  572. 1.6.1.  User-based Security Model Primitives for Authentication
  573.  
  574.    The User-based Security Model provides the following internal
  575.    primitives to pass data back and forth between the Security Model
  576.    itself and the authentication service:
  577.  
  578.    statusInformation =
  579.      authenticateOutgoingMsg(
  580.      IN   authKey                   -- secret key for authentication
  581.      IN   wholeMsg                  -- unauthenticated complete message
  582.      OUT  authenticatedWholeMsg     -- complete authenticated message
  583.           )
  584.  
  585.    statusInformation =
  586.      authenticateIncomingMsg(
  587.      IN   authKey                   -- secret key for authentication
  588.      IN   authParameters            -- as received on the wire
  589.      IN   wholeMsg                  -- as received on the wire
  590.      OUT  authenticatedWholeMsg     -- complete authenticated message
  591.           )
  592.  
  593. 1.6.2.  User-based Security Model Primitives for Privacy
  594.  
  595.    The User-based Security Model provides the following internal
  596.    primitives to pass data back and forth between the Security Model
  597.    itself and the privacy service:
  598.  
  599.    statusInformation =
  600.      encryptData(
  601.      IN    encryptKey               -- secret key for encryption
  602.      IN    dataToEncrypt            -- data to encrypt (scopedPDU)
  603.      OUT   encryptedData            -- encrypted data (encryptedPDU)
  604.      OUT   privParameters           -- filled in by service provider
  605.            )
  606.  
  607.    statusInformation =
  608.      decryptData(
  609.      IN    decryptKey               -- secret key for decrypting
  610.      IN    privParameters           -- as received on the wire
  611.      IN    encryptedData            -- encrypted data (encryptedPDU)
  612.      OUT   decryptedData            -- decrypted data (scopedPDU)
  613.               )
  614.  
  615.  
  616.  
  617.  
  618. Blumenthal & Wijnen         Standards Track                    [Page 11]
  619.  
  620. RFC 2264                     USM for SNMPv3                 January 1998
  621.  
  622.  
  623. 2.  Elements of the Model
  624.  
  625.    This section contains definitions required to realize the security
  626.    model defined by this memo.
  627.  
  628. 2.1.  User-based Security Model Users
  629.  
  630.    Management operations using this Security Model make use of a defined
  631.    set of user identities.  For any user on whose behalf management
  632.    operations are authorized at a particular SNMP engine, that SNMP
  633.    engine must have knowledge of that user.  An SNMP engine that wishes
  634.    to communicate with another SNMP engine must also have knowledge of a
  635.    user known to that engine, including knowledge of the applicable
  636.    attributes of that user.
  637.  
  638.    A user and its attributes are defined as follows:
  639.  
  640.    userName
  641.      A string representing the name of the user.
  642.  
  643.    securityName
  644.      A human-readable string representing the user in a format that is
  645.      Security Model independent.
  646.  
  647.    authProtocol
  648.      An indication of whether messages sent on behalf of this user can
  649.      be authenticated, and if so, the type of authentication protocol
  650.      which is used.  Two such protocols are defined in this memo:
  651.        - the HMAC-MD5-96 authentication protocol.
  652.        - the HMAC-SHA-96 authentication protocol.
  653.  
  654.    authKey
  655.      If messages sent on behalf of this user can be authenticated,
  656.      the (private) authentication key for use with the authentication
  657.      protocol.  Note that a user's authentication key will normally
  658.      be different at different authoritative SNMP engines. The authKey
  659.      is not accessible via SNMP. The length requirements of the authKey
  660.      are defined by the authProtocol in use.
  661.  
  662.    authKeyChange and authOwnKeyChange
  663.      The only way to remotely update the authentication key.  Does
  664.      that in a secure manner, so that the update can be completed
  665.      without the need to employ privacy protection.
  666.  
  667.  
  668.  
  669.  
  670.  
  671.  
  672.  
  673.  
  674. Blumenthal & Wijnen         Standards Track                    [Page 12]
  675.  
  676. RFC 2264                     USM for SNMPv3                 January 1998
  677.  
  678.  
  679.    privProtocol
  680.      An indication of whether messages sent on behalf of this user
  681.      can be protected from disclosure, and if so, the type of privacy
  682.      protocol which is used.  One such protocol is defined in this
  683.      memo: the CBC-DES Symmetric Encryption Protocol.
  684.  
  685.    privKey
  686.      If messages sent on behalf of this user can be en/decrypted,
  687.      the (private) privacy key for use with the privacy protocol.
  688.      Note that a user's privacy key will normally be different at
  689.      different authoritative SNMP engines. The privKey is not
  690.      accessible via SNMP. The length requirements of the privKey are
  691.      defined by the privProtocol in use.
  692.  
  693.    privKeyChange and privOwnKeyChange
  694.      The only way to remotely update the encryption key. Does that
  695.      in a secure manner, so that the update can be completed without
  696.      the need to employ privacy protection.
  697.  
  698. 2.2.  Replay Protection
  699.  
  700.    Each SNMP engine maintains three objects:
  701.  
  702.    - snmpEngineID, which (at least within an administrative domain)
  703.      uniquely and unambiguously identifies an SNMP engine.
  704.  
  705.    - snmpEngineBoots, which is a count of the number of times the
  706.      SNMP engine has re-booted/re-initialized since snmpEngineID
  707.      was last configured; and,
  708.  
  709.    - snmpEngineTime, which is the number of seconds since the
  710.      snmpEngineBoots counter was last incremented.
  711.  
  712.    Each SNMP engine is always authoritative with respect to these
  713.    objects in its own SNMP entity.  It is the responsibility of a
  714.    non-authoritative SNMP engine to synchronize with the
  715.    authoritative SNMP engine, as appropriate.
  716.  
  717.    An authoritative SNMP engine is required to maintain the values of
  718.    its snmpEngineID and snmpEngineBoots in non-volatile storage.
  719.  
  720. 2.2.1.  msgAuthoritativeEngineID
  721.  
  722.    The msgAuthoritativeEngineID value contained in an authenticated
  723.    message is used to defeat attacks in which messages from one SNMP
  724.    engine to another SNMP engine are replayed to a different SNMP
  725.    engine. It represents the snmpEngineID at the authoritative SNMP
  726.    engine involved in the exchange of the message.
  727.  
  728.  
  729.  
  730. Blumenthal & Wijnen         Standards Track                    [Page 13]
  731.  
  732. RFC 2264                     USM for SNMPv3                 January 1998
  733.  
  734.  
  735.    When an authoritative SNMP engine is first installed, it sets its
  736.    local value of snmpEngineID according to a enterprise-specific
  737.    algorithm (see the definition of the Textual Convention for
  738.    SnmpEngineID in the SNMP Architecture document [RFC2261]).
  739.  
  740. 2.2.2.  msgAuthoritativeEngineBoots and msgAuthoritativeEngineTime
  741.  
  742.    The msgAuthoritativeEngineBoots and msgAuthoritativeEngineTime
  743.    values contained in an authenticated message are used to defeat
  744.    attacks in which messages are replayed when they are no longer
  745.    valid.  They represent the snmpEngineBoots and snmpEngineTime
  746.    values at the authoritative SNMP engine involved in the exchange
  747.    of the message.
  748.  
  749.    Through use of snmpEngineBoots and snmpEngineTime, there is no
  750.    requirement for an SNMP engine to have a non-volatile clock which
  751.    ticks (i.e., increases with the passage of time) even when the
  752.    SNMP engine is powered off.  Rather, each time an SNMP engine
  753.    re-boots, it retrieves, increments, and then stores snmpEngineBoots
  754.    in non-volatile storage, and resets snmpEngineTime to zero.
  755.  
  756.    When an SNMP engine is first installed, it sets its local values
  757.    of snmpEngineBoots and snmpEngineTime to zero.  If snmpEngineTime
  758.    ever reaches its maximum value (2147483647), then snmpEngineBoots
  759.    is incremented as if the SNMP engine has re-booted and
  760.    snmpEngineTime is reset to zero and starts incrementing again.
  761.  
  762.    Each time an authoritative SNMP engine re-boots, any SNMP engines
  763.    holding that authoritative SNMP engine's values of snmpEngineBoots
  764.    and snmpEngineTime need to re-synchronize prior to sending
  765.    correctly authenticated messages to that authoritative SNMP engine
  766.    (see Section 2.3 for (re-)synchronization procedures).  Note,
  767.    however, that the procedures do provide for a notification to be
  768.    accepted as authentic by a receiving SNMP engine, when sent by an
  769.    authoritative SNMP engine which has re-booted since the receiving
  770.    SNMP engine last (re-)synchronized.
  771.  
  772.    If an authoritative SNMP engine is ever unable to determine its
  773.    latest snmpEngineBoots value, then it must set its snmpEngineBoots
  774.    value to 2147483647.
  775.  
  776.    Whenever the local value of snmpEngineBoots has the value 2147483647
  777.    it latches at that value and an authenticated message always causes
  778.    an notInTimeWindow authentication failure.
  779.  
  780.    In order to reset an SNMP engine whose snmpEngineBoots value has
  781.    reached the value 2147483647, manual intervention is required.
  782.    The engine must be physically visited and re-configured, either
  783.  
  784.  
  785.  
  786. Blumenthal & Wijnen         Standards Track                    [Page 14]
  787.  
  788. RFC 2264                     USM for SNMPv3                 January 1998
  789.  
  790.  
  791.    with a new snmpEngineID value, or with new secret values for the
  792.    authentication and privacy protocols of all users known to that
  793.    SNMP engine. Note that even if an SNMP engine re-boots once a second
  794.    that it would still take approximately 68 years before the max value
  795.    of 2147483647 would be reached.
  796.  
  797. 2.2.3.  Time Window
  798.  
  799.    The Time Window is a value that specifies the window of time in
  800.    which a message generated on behalf of any user is valid.  This
  801.    memo specifies that the same value of the Time Window, 150 seconds,
  802.    is used for all users.
  803.  
  804. 2.3.  Time Synchronization
  805.  
  806.    Time synchronization, required by a non-authoritative SNMP engine
  807.    in order to proceed with authentic communications, has occurred
  808.    when the non-authoritative SNMP engine has obtained a local notion
  809.    of the authoritative SNMP engine's values of snmpEngineBoots and
  810.    snmpEngineTime from the authoritative SNMP engine.  These values
  811.    must be (and remain) within the authoritative SNMP engine's Time
  812.    Window.  So the local notion of the authoritative SNMP engine's
  813.    values must be kept loosely synchronized with the values stored
  814.    at the authoritative SNMP engine.  In addition to keeping a local
  815.    copy of snmpEngineBoots and snmpEngineTime from the authoritative
  816.    SNMP engine, a non-authoritative SNMP engine must also keep one
  817.    local variable, latestReceivedEngineTime.  This value records the
  818.    highest value of snmpEngineTime that was received by the
  819.    non-authoritative SNMP engine from the authoritative SNMP engine
  820.    and is used to eliminate the possibility of replaying messages
  821.    that would prevent the non-authoritative SNMP engine's notion of
  822.    the snmpEngineTime from advancing.
  823.  
  824.    A non-authoritative SNMP engine must keep local notions of these
  825.    values for each authoritative SNMP engine with which it wishes to
  826.    communicate.  Since each authoritative SNMP engine is uniquely
  827.    and unambiguously identified by its value of snmpEngineID, the
  828.    non-authoritative SNMP engine may use this value as a key in
  829.    order to cache its local notions of these values.
  830.  
  831.    Time synchronization occurs as part of the procedures of receiving
  832.    an SNMP message (Section 3.2, step 7b). As such, no explicit time
  833.    synchronization procedure is required by a non-authoritative SNMP
  834.    engine.  Note, that whenever the local value of snmpEngineID is
  835.    changed (e.g., through discovery) or when secure communications
  836.    are first established with an authoritative SNMP engine, the local
  837.  
  838.  
  839.  
  840.  
  841.  
  842. Blumenthal & Wijnen         Standards Track                    [Page 15]
  843.  
  844. RFC 2264                     USM for SNMPv3                 January 1998
  845.  
  846.  
  847.    values of snmpEngineBoots and latestReceivedEngineTime should be
  848.    set to zero.  This will cause the time synchronization to occur
  849.    when the next authentic message is received.
  850.  
  851. 2.4.  SNMP Messages Using this Security Model
  852.  
  853.    The syntax of an SNMP message using this Security Model adheres
  854.    to the message format defined in the version-specific Message
  855.    Processing Model document (for example [RFC2262]).
  856.  
  857.    The field msgSecurityParameters in SNMPv3 messages has a data type
  858.    of OCTET STRING.  Its value is the BER serialization of the
  859.    following ASN.1 sequence:
  860.  
  861.    USMSecurityParametersSyntax DEFINITIONS IMPLICIT TAGS ::= BEGIN
  862.  
  863.       UsmSecurityParameters ::=
  864.           SEQUENCE {
  865.            -- global User-based security parameters
  866.               msgAuthoritativeEngineID     OCTET STRING,
  867.               msgAuthoritativeEngineBoots  INTEGER (0..2147483647),
  868.               msgAuthoritativeEngineTime   INTEGER (0..2147483647),
  869.               msgUserName                  OCTET STRING (SIZE(1..32)),
  870.            -- authentication protocol specific parameters
  871.               msgAuthenticationParameters  OCTET STRING,
  872.            -- privacy protocol specific parameters
  873.               msgPrivacyParameters         OCTET STRING
  874.           }
  875.    END
  876.  
  877.    The fields of this sequence are:
  878.  
  879.    - The msgAuthoritativeEngineID specifies the snmpEngineID of the
  880.      authoritative SNMP engine involved in the exchange of the message.
  881.  
  882.    - The msgAuthoritativeEngineBoots specifies the snmpEngineBoots
  883.      value at the authoritative SNMP engine involved in the exchange of
  884.      the message.
  885.  
  886.    - The msgAuthoritativeEngineTime specifies the snmpEngineTime value
  887.      at the authoritative SNMP engine involved in the exchange of the
  888.      message.
  889.  
  890.    - The msgUserName specifies the user (principal) on whose behalf
  891.      the message is being exchanged.
  892.  
  893.  
  894.  
  895.  
  896.  
  897.  
  898. Blumenthal & Wijnen         Standards Track                    [Page 16]
  899.  
  900. RFC 2264                     USM for SNMPv3                 January 1998
  901.  
  902.  
  903.    - The msgAuthenticationParameters are defined by the authentication
  904.      protocol in use for the message, as defined by the
  905.      usmUserAuthProtocol column in the user's entry in the usmUserTable.
  906.  
  907.    - The msgPrivacyParameters are defined by the privacy protocol in
  908.      use for the message, as defined by the usmUserPrivProtocol column
  909.      in the user's entry in the usmUserTable).
  910.  
  911.    See appendix A.4 for an example of the BER encoding of field
  912.    msgSecurityParameters.
  913.  
  914. 2.5.  Services provided by the User-based Security Model
  915.  
  916.    This section describes the services provided by the User-based
  917.    Security Model with their inputs and outputs.
  918.  
  919.    The services are described as primitives of an abstract service
  920.    interface and the inputs and outputs are described as abstract data
  921.    elements as they are passed in these abstract service primitives.
  922.  
  923. 2.5.1.  Services for Generating an Outgoing SNMP Message
  924.  
  925.    When the Message Processing (MP) Subsystem invokes the User-based
  926.    Security module to secure an outgoing SNMP message, it must use the
  927.    appropriate service as provided by the Security module.  These two
  928.    services are provided:
  929.  
  930.    1) A service to generate a Request message. The abstract service
  931.       primitive is:
  932.  
  933.       statusInformation =            -- success or errorIndication
  934.         generateRequestMsg(
  935.         IN   messageProcessingModel  -- typically, SNMP version
  936.         IN   globalData              -- message header, admin data
  937.         IN   maxMessageSize          -- of the sending SNMP entity
  938.         IN   securityModel           -- for the outgoing message
  939.         IN   securityEngineID        -- authoritative SNMP entity
  940.         IN   securityName            -- on behalf of this principal
  941.         IN   securityLevel           -- Level of Security requested
  942.         IN   scopedPDU               -- message (plaintext) payload
  943.         OUT  securityParameters      -- filled in by Security Module
  944.         OUT  wholeMsg                -- complete generated message
  945.         OUT  wholeMsgLength          -- length of generated message
  946.              )
  947.  
  948.    2) A service to generate a Response message. The abstract service
  949.       primitive is:
  950.  
  951.  
  952.  
  953.  
  954. Blumenthal & Wijnen         Standards Track                    [Page 17]
  955.  
  956. RFC 2264                     USM for SNMPv3                 January 1998
  957.  
  958.  
  959.       statusInformation =            -- success or errorIndication
  960.         generateResponseMsg(
  961.         IN   messageProcessingModel  -- typically, SNMP version
  962.         IN   globalData              -- message header, admin data
  963.         IN   maxMessageSize          -- of the sending SNMP entity
  964.         IN   securityModel           -- for the outgoing message
  965.         IN   securityEngineID        -- authoritative SNMP entity
  966.         IN   securityName            -- on behalf of this principal
  967.         IN   securityLevel           -- Level of Security requested
  968.         IN   scopedPDU               -- message (plaintext) payload
  969.         IN   securityStateReference  -- reference to security state
  970.                                      -- information from original
  971.                                      -- request
  972.         OUT  securityParameters      -- filled in by Security Module
  973.         OUT  wholeMsg                -- complete generated message
  974.         OUT  wholeMsgLength          -- length of generated message
  975.              )
  976.  
  977.    The abstract data elements passed as parameters in the abstract
  978.    service primitives are as follows:
  979.  
  980.     statusInformation
  981.       An indication of whether the encoding and securing of the message
  982.       was successful.  If not it is an indication of the problem.
  983.      essageProcessingModel
  984.       The SNMP version number for the message to be generated.  This
  985.       data is not used by the User-based Security module.
  986.     globalData
  987.       The message header (i.e., its administrative information). This
  988.       data is not used by the User-based Security module.
  989.     maxMessageSize
  990.       The maximum message size as included in the message.  This data is
  991.       not used by the User-based Security module.
  992.     securityParameters
  993.       These are the security parameters. They will be filled in by the
  994.       User-based Security module.
  995.     securityModel
  996.       The securityModel in use. Should be User-based Security Model.
  997.       This data is not used by the User-based Security module.
  998.     securityName
  999.       Together with the snmpEngineID it identifies a row in the
  1000.       usmUserTable that is to be used for securing the message.  The
  1001.       securityName has a format that is independent of the Security
  1002.       Model. In case of a response this parameter is ignored and the
  1003.       value from the cache is used.
  1004.     securityLevel
  1005.       The Level of Security from which the User-based Security module
  1006.       determines if the message needs to be protected from disclosure
  1007.  
  1008.  
  1009.  
  1010. Blumenthal & Wijnen         Standards Track                    [Page 18]
  1011.  
  1012. RFC 2264                     USM for SNMPv3                 January 1998
  1013.  
  1014.  
  1015.       and if the message needs to be authenticated.  In case of a
  1016.       response this parameter is ignored and the value from the cache is
  1017.       used.
  1018.     securityEngineID
  1019.       The snmpEngineID of the authoritative SNMP engine to which a
  1020.       Request message is to be sent. In case of a response it is implied
  1021.       to be the processing SNMP engine's snmpEngineID and so if it is
  1022.       specified, then it is ignored.
  1023.     scopedPDU
  1024.       The message payload.  The data is opaque as far as the User-based
  1025.       Security Model is concerned.
  1026.     securityStateReference
  1027.       A handle/reference to cachedSecurityData to be used when securing
  1028.       an outgoing Response message.  This is the exact same
  1029.       handle/reference as it was generated by the User-based Security
  1030.       module when processing the incoming Request message to which this
  1031.       is the Response message.
  1032.     wholeMsg
  1033.       The fully encoded and secured message ready for sending on the
  1034.       wire.
  1035.     wholeMsgLength
  1036.       The length of the encoded and secured message (wholeMsg).
  1037.  
  1038.    Upon completion of the process, the User-based Security module
  1039.    returns statusInformation. If the process was successful, the
  1040.    completed message with privacy and authentication applied if such was
  1041.    requested by the specified securityLevel is returned. If the process
  1042.    was not successful, then an errorIndication is returned.
  1043.  
  1044. 2.5.2.  Services for Processing an Incoming SNMP Message
  1045.  
  1046.    When the Message Processing (MP) Subsystem invokes the User-based
  1047.    Security module to verify proper security of an incoming message, it
  1048.    must use the service provided for an incoming message. The abstract
  1049.    service primitive is:
  1050.  
  1051.    statusInformation =             -- errorIndication or success
  1052.                                    -- error counter OID/value if error
  1053.      processIncomingMsg(
  1054.      IN   messageProcessingModel   -- typically, SNMP version
  1055.      IN   maxMessageSize           -- of the sending SNMP entity
  1056.      IN   securityParameters       -- for the received message
  1057.      IN   securityModel            -- for the received message
  1058.      IN   securityLevel            -- Level of Security
  1059.      IN   wholeMsg                 -- as received on the wire
  1060.      IN   wholeMsgLength           -- length as received on the wire
  1061.      OUT  securityEngineID         -- authoritative SNMP entity
  1062.      OUT  securityName             -- identification of the principal
  1063.  
  1064.  
  1065.  
  1066. Blumenthal & Wijnen         Standards Track                    [Page 19]
  1067.  
  1068. RFC 2264                     USM for SNMPv3                 January 1998
  1069.  
  1070.  
  1071.      OUT  scopedPDU,               -- message (plaintext) payload
  1072.      OUT  maxSizeResponseScopedPDU -- maximum size of the Response PDU
  1073.      OUT  securityStateReference   -- reference to security state
  1074.           )                        -- information, needed for response
  1075.  
  1076.    The abstract data elements passed as parameters in the abstract
  1077.    service primitives are as follows:
  1078.  
  1079.     statusInformation
  1080.       An indication of whether the process was successful or not.  If
  1081.       not, then the statusInformation includes the OID and the value of
  1082.       the error counter that was incremented.
  1083.     messageProcessingModel
  1084.       The SNMP version number as received in the message.  This data is
  1085.       not used by the User-based Security module.
  1086.     maxMessageSize
  1087.       The maximum message size as included in the message.  The User-
  1088.       based Security module uses this value to calculate the
  1089.       maxSizeResponseScopedPDU.
  1090.     securityParameters
  1091.       These are the security parameters as received in the message.
  1092.     securityModel
  1093.       The securityModel in use.  Should be the User-based Security
  1094.       Model.  This data is not used by the User-based Security module.
  1095.     securityLevel
  1096.       The Level of Security from which the User-based Security module
  1097.       determines if the message needs to be protected from disclosure
  1098.       and if the message needs to be authenticated.
  1099.     wholeMsg
  1100.       The whole message as it was received.
  1101.     wholeMsgLength
  1102.       The length of the message as it was received (wholeMsg).
  1103.     securityEngineID
  1104.       The snmpEngineID that was extracted from the field
  1105.       msgAuthoritativeEngineID and that was used to lookup the secrets
  1106.       in the usmUserTable.
  1107.     securityName
  1108.       The security name representing the user on whose behalf the
  1109.       message was received.  The securityName has a format that is
  1110.       independent of the Security Model.
  1111.     scopedPDU
  1112.       The message payload.  The data is opaque as far as the User-based
  1113.       Security Model is concerned.
  1114.     maxSizeResponseScopedPDU
  1115.       The maximum size of a scopedPDU to be included in a possible
  1116.       Response message.  The User-base Security module calculates
  1117.  
  1118.  
  1119.  
  1120.  
  1121.  
  1122. Blumenthal & Wijnen         Standards Track                    [Page 20]
  1123.  
  1124. RFC 2264                     USM for SNMPv3                 January 1998
  1125.  
  1126.  
  1127.       this size based on the mms (as received in the message) and the
  1128.       space required for the message header (including the
  1129.       securityParameters) for such a Response message.
  1130.     securityStateReference
  1131.       A handle/reference to cachedSecurityData to be used when securing
  1132.       an outgoing Response message.  When the Message Processing
  1133.       Subsystem calls the User-based Security module to generate a
  1134.       response to this incoming message it must pass this
  1135.       handle/reference.
  1136.  
  1137.    Upon completion of the process, the User-based Security module
  1138.    returns statusInformation and, if the process was successful, the
  1139.    additional data elements for further processing of the message.  If
  1140.    the process was not successful, then an errorIndication, possibly
  1141.    with a OID and value pair of an error counter that was incremented.
  1142.  
  1143. 2.6.  Key Localization Algorithm.
  1144.  
  1145.    A localized key is a secret key shared between a user U and one
  1146.    authoritative SNMP engine E.  Even though a user may have only one
  1147.    password and therefore one key for the whole network, the actual
  1148.    secrets shared between the user and each authoritative SNMP engine
  1149.    will be different. This is achieved by key localization [Localized-
  1150.    key].
  1151.  
  1152.    First, if a user uses a password, then the user's password is
  1153.    converted into a key Ku using one of the two algorithms described in
  1154.    Appendices A.2.1 and A.2.2.
  1155.  
  1156.    To convert key Ku into a localized key Kul of user U at the
  1157.    authoritative SNMP engine E, one appends the snmpEngineID of the
  1158.    authoritative SNMP engine to the key Ku and then appends the key Ku
  1159.    to the result, thus enveloping the snmpEngineID within the two copies
  1160.    of user's key Ku. Then one runs a secure hash function (which one
  1161.    depends on the authentication protocol defined for this user U at
  1162.    authoritative SNMP engine E; this document defines two authentication
  1163.    protocols with their associated algorithms based on MD5 and SHA). The
  1164.    output of the hash-function is the localized key Kul for user U at
  1165.    the authoritative SNMP engine E.
  1166.  
  1167. 3.  Elements of Procedure
  1168.  
  1169.    This section describes the security related procedures followed by an
  1170.    SNMP engine when processing SNMP messages according to the User-based
  1171.    Security Model.
  1172.  
  1173.  
  1174.  
  1175.  
  1176.  
  1177.  
  1178. Blumenthal & Wijnen         Standards Track                    [Page 21]
  1179.  
  1180. RFC 2264                     USM for SNMPv3                 January 1998
  1181.  
  1182.  
  1183. 3.1.  Generating an Outgoing SNMP Message
  1184.  
  1185.    This section describes the procedure followed by an SNMP engine
  1186.    whenever it generates a message containing a management operation
  1187.    (like a request, a response, a notification, or a report) on behalf
  1188.    of a user, with a particular securityLevel.
  1189.  
  1190.    1)  a) If any securityStateReference is passed (Response message),
  1191.           then information concerning the user is extracted from the
  1192.           cachedSecurityData.  The securityEngineID and the
  1193.           securityLevel are extracted from the cachedSecurityData.  The
  1194.           cachedSecurityData can now be discarded.
  1195.  
  1196.           Otherwise,
  1197.  
  1198.        b) based on the securityName, information concerning the
  1199.           user at the destination snmpEngineID, specified by the
  1200.           securityEngineID, is extracted from the Local Configuration
  1201.           Datastore (LCD, usmUserTable). If information about the user
  1202.           is absent from the LCD, then an error indication
  1203.           (unknownSecurityName) is returned to the calling module.
  1204.  
  1205.    2)  If the securityLevel specifies that the message is to be
  1206.        protected from disclosure, but the user does not support both an
  1207.        authentication and a privacy protocol then the message cannot be
  1208.        sent.  An error indication (unsupportedSecurityLevel) is returned
  1209.        to the calling module.
  1210.  
  1211.    3)  If the securityLevel specifies that the message is to be
  1212.        authenticated, but the user does not support an authentication
  1213.        protocol, then the message cannot be sent. An error indication
  1214.        (unsupportedSecurityLevel) is returned to the calling module.
  1215.  
  1216.    4)  a) If the securityLevel specifies that the message is to be
  1217.           protected from disclosure, then the octet sequence
  1218.           representing the serialized scopedPDU is encrypted according
  1219.           to the user's privacy protocol. To do so a call is made to the
  1220.           privacy module that implements the user's privacy protocol
  1221.           according to the abstract primitive:
  1222.  
  1223.           statusInformation =       -- success or failure
  1224.             encryptData(
  1225.             IN    encryptKey        -- user's localized privKey
  1226.             IN    dataToEncrypt     -- serialized scopedPDU
  1227.             OUT   encryptedData     -- serialized encryptedPDU
  1228.             OUT   privParameters    -- serialized privacy parameters
  1229.                   )
  1230.  
  1231.  
  1232.  
  1233.  
  1234. Blumenthal & Wijnen         Standards Track                    [Page 22]
  1235.  
  1236. RFC 2264                     USM for SNMPv3                 January 1998
  1237.  
  1238.  
  1239.           statusInformation
  1240.             indicates if the encryption process was successful or not.
  1241.           encryptKey
  1242.             the user's localized private privKey is the secret key that
  1243.             can be used by the encryption algorithm.
  1244.           dataToEncrypt
  1245.             the serialized scopedPDU is the data that to be encrypted.
  1246.           encryptedData
  1247.             the encryptedPDU represents the encrypted scopedPDU,
  1248.             encoded as an OCTET STRING.
  1249.           privParameters
  1250.             the privacy parameters, encoded as an OCTET STRING.
  1251.  
  1252.           If the privacy module returns failure, then the message cannot
  1253.           be sent and an error indication (encryptionError) is returned
  1254.           to the calling module.
  1255.  
  1256.           If the privacy module returns success, then the returned
  1257.           privParameters are put into the msgPrivacyParameters field of
  1258.           the securityParameters and the encryptedPDU serves as the
  1259.           payload of the message being prepared.
  1260.  
  1261.           Otherwise,
  1262.  
  1263.        b) If the securityLevel specifies that the message is not to be
  1264.           protected from disclosure, then the NULL string is encoded as
  1265.           an OCTET STRING and put into the msgPrivacyParameters field of
  1266.           the securityParameters and the plaintext scopedPDU serves as
  1267.           the payload of the message being prepared.
  1268.  
  1269.    5)  The snmpEngineID is encoded as an OCTET STRING into the
  1270.        msgAuthoritativeEngineID field of the securityParameters.  Note
  1271.        that an empty (zero length) snmpEngineID is OK for a Request
  1272.        message, because that will cause the remote (authoritative) SNMP
  1273.        engine to return a Report PDU with the proper snmpEngineID
  1274.        included in the msgAuthoritativeEngineID in the
  1275.        securityParameters of that returned Report PDU.
  1276.  
  1277.    6)  a) If the securityLevel specifies that the message is to be
  1278.           authenticated, then the current values of snmpEngineBoots and
  1279.           snmpEngineTime corresponding to the snmpEngineID from the LCD
  1280.           are used.
  1281.  
  1282.           Otherwise,
  1283.  
  1284.        b) If this is a Response message, then the current value of
  1285.           snmpEngineBoots and snmpEngineTime corresponding to the local
  1286.           snmpEngineID from the LCD are used.
  1287.  
  1288.  
  1289.  
  1290. Blumenthal & Wijnen         Standards Track                    [Page 23]
  1291.  
  1292. RFC 2264                     USM for SNMPv3                 January 1998
  1293.  
  1294.  
  1295.           Otherwise,
  1296.  
  1297.        c) If this is a Request message, then a zero value is used
  1298.           for both snmpEngineBoots and snmpEngineTime. This zero value
  1299.           gets used if snmpEngineID is empty.
  1300.  
  1301.        The values are encoded as INTEGER respectively into the
  1302.        msgAuthoritativeEngineBoots and msgAuthoritativeEngineTime fields
  1303.        of the securityParameters.
  1304.  
  1305.    7)  The userName is encoded as an OCTET STRING into the msgUserName
  1306.        field of the securityParameters.
  1307.  
  1308.    8)  a) If the securityLevel specifies that the message is to be
  1309.           authenticated, the message is authenticated according to the
  1310.           user's authentication protocol. To do so a call is made to the
  1311.           authentication module that implements the user's
  1312.           authentication protocol according to the abstract service
  1313.           primitive:
  1314.  
  1315.           statusInformation =
  1316.             authenticateOutgoingMsg(
  1317.             IN  authKey               -- the user's localized authKey
  1318.             IN  wholeMsg              -- unauthenticated message
  1319.             OUT authenticatedWholeMsg -- authenticated complete message
  1320.                 )
  1321.  
  1322.           statusInformation
  1323.             indicates if authentication was successful or not.
  1324.           authKey
  1325.             the user's localized private authKey is the secret key that
  1326.             can be used by the authentication algorithm.
  1327.           wholeMsg
  1328.             the complete serialized message to be authenticated.
  1329.           authenticatedWholeMsg
  1330.             the same as the input given to the authenticateOutgoingMsg
  1331.             service, but with msgAuthenticationParameters properly
  1332.             filled in.
  1333.  
  1334.           If the authentication module returns failure, then the message
  1335.           cannot be sent and an error indication (authenticationFailure)
  1336.           is returned to the calling module.
  1337.  
  1338.           If the authentication module returns success, then the
  1339.           msgAuthenticationParameters field is put into the
  1340.           securityParameters and the authenticatedWholeMsg represents
  1341.           the serialization of the authenticated message being prepared.
  1342.  
  1343.  
  1344.  
  1345.  
  1346. Blumenthal & Wijnen         Standards Track                    [Page 24]
  1347.  
  1348. RFC 2264                     USM for SNMPv3                 January 1998
  1349.  
  1350.  
  1351.           Otherwise,
  1352.  
  1353.        b) If the securityLevel specifies that the message is not to
  1354.           be authenticated then the NULL string is encoded as an OCTET
  1355.           STRING into the msgAuthenticationParameters field of the
  1356.           securityParameters.  The wholeMsg is now serialized and then
  1357.           represents the unauthenticated message being prepared.
  1358.  
  1359.    9)  The completed message with its length is returned to the
  1360.        calling module with the statusInformation set to success.
  1361.  
  1362. 3.2.  Processing an Incoming SNMP Message
  1363.  
  1364.    This section describes the procedure followed by an SNMP engine
  1365.    whenever it receives a message containing a management operation on
  1366.    behalf of a user, with a particular securityLevel.
  1367.  
  1368.    To simplify the elements of procedure, the release of state
  1369.    information is not always explicitly specified. As a general rule, if
  1370.    state information is available when a message gets discarded, the
  1371.    state information should also be released.  Also, when an error
  1372.    indication with an OID and value for an incremented counter is
  1373.    returned, then the available information (like
  1374.    securityStateReference) must be passed back to the caller so it can
  1375.    generate a Report PDU.
  1376.  
  1377.    1)  If the received securityParameters is not the serialization
  1378.        (according to the conventions of [RFC1906]) of an OCTET STRING
  1379.        formatted according to the UsmSecurityParameters defined in
  1380.        section 2.4, then the snmpInASNParseErrs counter [RFC1907] is
  1381.        incremented, and an error indication (parseError) is returned to
  1382.        the calling module.  Note that we return without the OID and
  1383.        value of the incremented counter, because in this case there is
  1384.        not enough information to generate a Report PDU.
  1385.  
  1386.    2)  The values of the security parameter fields are extracted from
  1387.        the securityParameters. The securityEngineID to be returned to
  1388.        the caller is the value of the msgAuthoritativeEngineID field.
  1389.        The cachedSecurityData is prepared and a securityStateReference
  1390.        is prepared to reference this data. Values to be cached are:
  1391.  
  1392.            msgUserName
  1393.            securityEngineID
  1394.            securityLevel
  1395.  
  1396.    3)  If the value of the msgAuthoritativeEngineID field in the
  1397.        securityParameters is unknown then:
  1398.  
  1399.  
  1400.  
  1401.  
  1402. Blumenthal & Wijnen         Standards Track                    [Page 25]
  1403.  
  1404. RFC 2264                     USM for SNMPv3                 January 1998
  1405.  
  1406.  
  1407.        a) a non-authoritative SNMP engine that performs discovery may
  1408.           optionally create a new entry in its Local Configuration
  1409.           Datastore (LCD) and continue processing;
  1410.  
  1411.           or
  1412.  
  1413.        b) the usmStatsUnknownEngineIDs counter is incremented, and
  1414.           an error indication (unknownEngineID) together with the
  1415.           OID and value of the incremented counter is returned to
  1416.           the calling module.
  1417.  
  1418.    4)  Information about the value of the msgUserName and
  1419.        msgAuthoritativeEngineID fields is extracted from the Local
  1420.        Configuration Datastore (LCD, usmUserTable).  If no information
  1421.        is available for the user, then the usmStatsUnknownUserNames
  1422.        counter is incremented and an error indication
  1423.        (unknownSecurityName) together with the OID and value of the
  1424.        incremented counter is returned to the calling module.
  1425.  
  1426.    5)  If the information about the user indicates that it does not
  1427.        support the securityLevel requested by the caller, then the
  1428.        usmStatsUnsupportedSecLevels counter is incremented and an
  1429.        error indication (unsupportedSecurityLevel) together with the
  1430.        OID and value of the incremented counter is returned to the
  1431.        calling module.
  1432.  
  1433.    6)  If the securityLevel specifies that the message is to be
  1434.        authenticated, then the message is authenticated according to
  1435.        the user's authentication protocol. To do so a call is made
  1436.        to the authentication module that implements the user's
  1437.        authentication protocol according to the abstract service
  1438.        primitive:
  1439.  
  1440.        statusInformation =          -- success or failure
  1441.          authenticateIncomingMsg(
  1442.          IN   authKey               -- the user's localized authKey
  1443.          IN   authParameters        -- as received on the wire
  1444.          IN   wholeMsg              -- as received on the wire
  1445.          OUT  authenticatedWholeMsg -- checked for authentication
  1446.                  )
  1447.  
  1448.        statusInformation
  1449.          indicates if authentication was successful or not.
  1450.        authKey
  1451.          the user's localized private authKey is the secret key that
  1452.          can be used by the authentication algorithm.
  1453.        wholeMsg
  1454.          the complete serialized message to be authenticated.
  1455.  
  1456.  
  1457.  
  1458. Blumenthal & Wijnen         Standards Track                    [Page 26]
  1459.  
  1460. RFC 2264                     USM for SNMPv3                 January 1998
  1461.  
  1462.  
  1463.        authenticatedWholeMsg
  1464.          the same as the input given to the authenticateIncomingMsg
  1465.          service, but after authentication has been checked.
  1466.  
  1467.        If the authentication module returns failure, then the message
  1468.               cannot be trusted, so the usmStatsWrongDigests counter is
  1469.        incremented and an error indication (authenticationFailure)
  1470.        together with the OID and value of the incremented counter is
  1471.        returned to the calling module.
  1472.  
  1473.        If the authentication module returns success, then the message
  1474.        is authentic and can be trusted so processing continues.
  1475.  
  1476.    7)  If the securityLevel indicates an authenticated message, then
  1477.        the local values of snmpEngineBoots and snmpEngineTime
  1478.        corresponding to the value of the msgAuthoritativeEngineID
  1479.        field are extracted from the Local Configuration Datastore.
  1480.  
  1481.        a) If the extracted value of msgAuthoritativeEngineID is the
  1482.           same as the value of snmpEngineID of the processing SNMP
  1483.           engine (meaning this is the authoritative SNMP engine),
  1484.           then if any of the following conditions is true, then the
  1485.           message is considered to be outside of the Time Window:
  1486.  
  1487.            - the local value of snmpEngineBoots is 2147483647;
  1488.  
  1489.            - the value of the msgAuthoritativeEngineBoots field differs
  1490.              from the local value of snmpEngineBoots; or,
  1491.  
  1492.            - the value of the msgAuthoritativeEngineTime field differs
  1493.              from the local notion of snmpEngineTime by more than
  1494.              +/- 150 seconds.
  1495.  
  1496.           If the message is considered to be outside of the Time Window
  1497.           then the usmStatsNotInTimeWindows counter is incremented and
  1498.           an error indication (notInTimeWindow) together with the OID
  1499.           and value of the incremented counter is returned to the
  1500.           calling module.
  1501.  
  1502.        b) If the extracted value of msgAuthoritativeEngineID is not the
  1503.           same as the value snmpEngineID of the processing SNMP engine
  1504.           (meaning this is not the authoritative SNMP engine), then:
  1505.  
  1506.           1) if at least one of the following conditions is true:
  1507.  
  1508.              - the extracted value of the msgAuthoritativeEngineBoots
  1509.                field is greater than the local notion of the value of
  1510.                snmpEngineBoots; or,
  1511.  
  1512.  
  1513.  
  1514. Blumenthal & Wijnen         Standards Track                    [Page 27]
  1515.  
  1516. RFC 2264                     USM for SNMPv3                 January 1998
  1517.  
  1518.  
  1519.              - the extracted value of the msgAuthoritativeEngineBoots
  1520.                field is equal to the local notion of the value of
  1521.                snmpEngineBoots, the extracted value of
  1522.                msgAuthoritativeEngineTime field is greater than the
  1523.                value of latestReceivedEngineTime,
  1524.  
  1525.              then the LCD entry corresponding to the extracted value
  1526.              of the msgAuthoritativeEngineID field is updated, by
  1527.              setting:
  1528.  
  1529.                 - the local notion of the value of snmpEngineBoots to
  1530.                   the value of the msgAuthoritativeEngineBoots field,
  1531.                 - the local notion of the value of snmpEngineTime to
  1532.                   the value of the msgAuthoritativeEngineTime field,
  1533.                   and
  1534.                 - the latestReceivedEngineTime to the value of the
  1535.                   value of the msgAuthoritativeEngineTime field.
  1536.  
  1537.           2) if any of the following conditions is true, then the
  1538.              message is considered to be outside of the Time Window:
  1539.  
  1540.              - the local notion of the value of snmpEngineBoots is
  1541.                2147483647;
  1542.  
  1543.              - the value of the msgAuthoritativeEngineBoots field is
  1544.                less than the local notion of the value of
  1545.                snmpEngineBoots; or,
  1546.  
  1547.              - the value of the msgAuthoritativeEngineBoots field is
  1548.                equal to the local notion of the value of
  1549.                snmpEngineBoots and the value of the
  1550.                msgAuthoritativeEngineTime field is more than 150
  1551.                seconds less than the local notion of of the value of
  1552.                snmpEngineTime.
  1553.  
  1554.              If the message is considered to be outside of the Time
  1555.              Window then an error indication (notInTimeWindow) is
  1556.              returned to the calling module;
  1557.  
  1558.              Note that this means that a too old (possibly replayed)
  1559.              message has been detected and is deemed unauthentic.
  1560.  
  1561.              Note that this procedure allows for the value of
  1562.              msgAuthoritativeEngineBoots in the message to be greater
  1563.              than the local notion of the value of snmpEngineBoots to
  1564.              allow for received messages to be accepted as authentic
  1565.  
  1566.  
  1567.  
  1568.  
  1569.  
  1570. Blumenthal & Wijnen         Standards Track                    [Page 28]
  1571.  
  1572. RFC 2264                     USM for SNMPv3                 January 1998
  1573.  
  1574.  
  1575.              when received from an authoritative SNMP engine that has
  1576.              re-booted since the receiving SNMP engine last
  1577.              (re-)synchronized.
  1578.  
  1579.              Note that this procedure does not allow for automatic
  1580.              time synchronization if the non-authoritative SNMP engine
  1581.              has a real out-of-sync situation whereby the authoritative
  1582.              SNMP engine is more than 150 seconds behind the
  1583.              non-authoritative SNMP engine.
  1584.  
  1585.    8)  a) If the securityLevel indicates that the message was protected
  1586.           from disclosure, then the OCTET STRING representing the
  1587.           encryptedPDU is decrypted according to the user's privacy
  1588.           protocol to obtain an unencrypted serialized scopedPDU value.
  1589.           To do so a call is made to the privacy module that implements
  1590.           the user's privacy protocol according to the abstract
  1591.           primitive:
  1592.  
  1593.           statusInformation =       -- success or failure
  1594.             decryptData(
  1595.             IN    decryptKey        -- the user's localized privKey
  1596.             IN    privParameters    -- as received on the wire
  1597.             IN    encryptedData     -- encryptedPDU as received
  1598.             OUT   decryptedData     -- serialized decrypted scopedPDU
  1599.                   )
  1600.  
  1601.           statusInformation
  1602.             indicates if the decryption process was successful or not.
  1603.           decryptKey
  1604.             the user's localized private privKey is the secret key that
  1605.             can be used by the decryption algorithm.
  1606.           privParameters
  1607.             the msgPrivacyParameters, encoded as an OCTET STRING.
  1608.           encryptedData
  1609.             the encryptedPDU represents the encrypted scopedPDU, encoded
  1610.             as an OCTET STRING.
  1611.           decryptedData
  1612.             the serialized scopedPDU if decryption is successful.
  1613.  
  1614.           If the privacy module returns failure, then the message can
  1615.           not be processed, so the usmStatsDecryptionErrors counter is
  1616.           incremented and an error indication (decryptionError) together
  1617.           with the OID and value of the incremented counter is returned
  1618.           to the calling module.
  1619.  
  1620.           If the privacy module returns success, then the decrypted
  1621.           scopedPDU is the message payload to be returned to the calling
  1622.           module.
  1623.  
  1624.  
  1625.  
  1626. Blumenthal & Wijnen         Standards Track                    [Page 29]
  1627.  
  1628. RFC 2264                     USM for SNMPv3                 January 1998
  1629.  
  1630.  
  1631.           Otherwise,
  1632.  
  1633.        b) The scopedPDU component is assumed to be in plain text
  1634.           and is the message payload to be returned to the calling
  1635.           module.
  1636.  
  1637.    9)  The maxSizeResponseScopedPDU is calculated.  This is the
  1638.        maximum size allowed for a scopedPDU for a possible Response
  1639.        message.  Provision is made for a message header that allows the
  1640.        same securityLevel as the received Request.
  1641.  
  1642.    10) The securityName for the user is retrieved from the
  1643.        usmUserTable.
  1644.  
  1645.    11) The security data is cached as cachedSecurityData, so that a
  1646.        possible response to this message can and will use the same
  1647.        authentication and privacy secrets, the same securityLevel and
  1648.        the same value for msgAuthoritativeEngineID.  Information to be
  1649.        saved/cached is as follows:
  1650.  
  1651.           msgUserName,
  1652.           usmUserAuthProtocol, usmUserAuthKey
  1653.           usmUserPrivProtocol, usmUserPrivKey
  1654.           securityEngineID, securityLevel
  1655.  
  1656.    12) The statusInformation is set to success and a return is made to
  1657.        the calling module passing back the OUT parameters as specified
  1658.        in the processIncomingMsg primitive.
  1659.  
  1660. 4.  Discovery
  1661.  
  1662.    The User-based Security Model requires that a discovery process
  1663.    obtains sufficient information about other SNMP engines in order to
  1664.    communicate with them.  Discovery requires an non-authoritative SNMP
  1665.    engine to learn the authoritative SNMP engine's snmpEngineID value
  1666.    before communication may proceed.  This may be accomplished by
  1667.    generating a Request message with a securityLevel of noAuthNoPriv, a
  1668.    msgUserName of "initial", a msgAuthoritativeEngineID value of zero
  1669.    length, and the varBindList left empty.  The response to this message
  1670.    will be a Report message containing the snmpEngineID of the
  1671.    authoritative SNMP engine as the value of the
  1672.    msgAuthoritativeEngineID field within the msgSecurityParameters
  1673.    field.  It contains a Report PDU with the usmStatsUnknownEngineIDs
  1674.    counter in the varBindList.
  1675.  
  1676.    If authenticated communication is required, then the discovery
  1677.    process should also establish time synchronization with the
  1678.    authoritative SNMP engine.  This may be accomplished by sending an
  1679.  
  1680.  
  1681.  
  1682. Blumenthal & Wijnen         Standards Track                    [Page 30]
  1683.  
  1684. RFC 2264                     USM for SNMPv3                 January 1998
  1685.  
  1686.  
  1687.    authenticated Request message with the value of
  1688.    msgAuthoritativeEngineID set to the newly learned snmpEngineID and
  1689.    with the values of msgAuthoritativeEngineBoots and
  1690.    msgAuthoritativeEngineTime set to zero.  The response to this
  1691.    authenticated message will be a Report message containing the up to
  1692.    date values of the authoritative SNMP engine's snmpEngineBoots and
  1693.    snmpEngineTime as the value of the msgAuthoritativeEngineBoots and
  1694.    msgAuthoritativeEngineTime fields respectively.  It also contains the
  1695.    usmStatsNotInTimeWindows counter in the varBindList of the Report
  1696.    PDU.  The time synchronization then happens automatically as part of
  1697.    the procedures in section 3.2 step 7b. See also section 2.3.
  1698.  
  1699. 5.  Definitions
  1700.  
  1701. SNMP-USER-BASED-SM-MIB DEFINITIONS ::= BEGIN
  1702.  
  1703. IMPORTS
  1704.     MODULE-IDENTITY, OBJECT-TYPE,
  1705.     OBJECT-IDENTITY,
  1706.     snmpModules, Counter32                FROM SNMPv2-SMI
  1707.     TEXTUAL-CONVENTION, TestAndIncr,
  1708.     RowStatus, RowPointer,
  1709.     StorageType, AutonomousType           FROM SNMPv2-TC
  1710.     MODULE-COMPLIANCE, OBJECT-GROUP       FROM SNMPv2-CONF
  1711.     SnmpAdminString, SnmpEngineID,
  1712.     snmpAuthProtocols, snmpPrivProtocols  FROM SNMP-FRAMEWORK-MIB;
  1713.  
  1714. snmpUsmMIB MODULE-IDENTITY
  1715.     LAST-UPDATED "9711200000Z"            -- 20 Nov 1997, midnight
  1716.     ORGANIZATION "SNMPv3 Working Group"
  1717.     CONTACT-INFO "WG-email:   snmpv3@tis.com
  1718.                   Subscribe:  majordomo@tis.com
  1719.                               In msg body:  subscribe snmpv3
  1720.  
  1721.                   Chair:      Russ Mundy
  1722.                               Trusted Information Systems
  1723.                   postal:     3060 Washington Rd
  1724.                               Glenwood MD 21738
  1725.                               USA
  1726.                   email:      mundy@tis.com
  1727.                   phone:      +1-301-854-6889
  1728.  
  1729.                   Co-editor   Uri Blumenthal
  1730.                               IBM T. J. Watson Research
  1731.                   postal:     30 Saw Mill River Pkwy,
  1732.                               Hawthorne, NY 10532
  1733.                               USA
  1734.                   email:      uri@watson.ibm.com
  1735.  
  1736.  
  1737.  
  1738. Blumenthal & Wijnen         Standards Track                    [Page 31]
  1739.  
  1740. RFC 2264                     USM for SNMPv3                 January 1998
  1741.  
  1742.  
  1743.                   phone:      +1-914-784-7964
  1744.  
  1745.                   Co-editor:  Bert Wijnen
  1746.                               IBM T. J. Watson Research
  1747.                   postal:     Schagen 33
  1748.                               3461 GL Linschoten
  1749.                               Netherlands
  1750.                   email:      wijnen@vnet.ibm.com
  1751.                   phone:      +31-348-432-794
  1752.                  "
  1753.  
  1754.     DESCRIPTION  "The management information definitions for the
  1755.                   SNMP User-based Security Model.
  1756.                  "
  1757.     ::= { snmpModules 4 }
  1758.  
  1759. -- Administrative assignments ****************************************
  1760.  
  1761. usmMIBObjects     OBJECT IDENTIFIER ::= { snmpUsmMIB 1 }
  1762. usmMIBConformance OBJECT IDENTIFIER ::= { snmpUsmMIB 2 }
  1763.  
  1764. -- Identification of Authentication and Privacy Protocols ************
  1765.  
  1766. usmNoAuthProtocol OBJECT-IDENTITY
  1767.     STATUS        current
  1768.     DESCRIPTION  "No Authentication Protocol."
  1769.     ::= { snmpAuthProtocols 1 }
  1770.  
  1771. usmHMACMD5AuthProtocol OBJECT-IDENTITY
  1772.     STATUS        current
  1773.     DESCRIPTION  "The HMAC-MD5-96 Digest Authentication Protocol."
  1774.     REFERENCE    "- H. Krawczyk, M. Bellare, R. Canetti HMAC:
  1775.                     Keyed-Hashing for Message Authentication,
  1776.                     RFC2104, Feb 1997.
  1777.                   - Rivest, R., Message Digest Algorithm MD5, RFC1321.
  1778.                  "
  1779.     ::= { snmpAuthProtocols 2 }
  1780.  
  1781. usmHMACSHAAuthProtocol OBJECT-IDENTITY
  1782.     STATUS        current
  1783.     DESCRIPTION  "The HMAC-SHA-96 Digest Authentication Protocol."
  1784.     REFERENCE    "- H. Krawczyk, M. Bellare, R. Canetti, HMAC:
  1785.                     Keyed-Hashing for Message Authentication,
  1786.                     RFC2104, Feb 1997.
  1787.                   - Secure Hash Algorithm. NIST FIPS 180-1.
  1788.                  "
  1789.     ::= { snmpAuthProtocols 3 }
  1790.  
  1791.  
  1792.  
  1793.  
  1794. Blumenthal & Wijnen         Standards Track                    [Page 32]
  1795.  
  1796. RFC 2264                     USM for SNMPv3                 January 1998
  1797.  
  1798.  
  1799. usmNoPrivProtocol OBJECT-IDENTITY
  1800.     STATUS        current
  1801.     DESCRIPTION  "No Privacy Protocol."
  1802.     ::= { snmpPrivProtocols 1 }
  1803.  
  1804. usmDESPrivProtocol OBJECT-IDENTITY
  1805.     STATUS        current
  1806.     DESCRIPTION  "The CBC-DES Symmetric Encryption Protocol."
  1807.     REFERENCE    "- Data Encryption Standard, National Institute of
  1808.                     Standards and Technology.  Federal Information
  1809.                     Processing Standard (FIPS) Publication 46-1.
  1810.                     Supersedes FIPS Publication 46,
  1811.                     (January, 1977; reaffirmed January, 1988).
  1812.  
  1813.                   - Data Encryption Algorithm, American National
  1814.                     Standards Institute.  ANSI X3.92-1981,
  1815.                     (December, 1980).
  1816.  
  1817.                   - DES Modes of Operation, National Institute of
  1818.                     Standards and Technology.  Federal Information
  1819.                     Processing Standard (FIPS) Publication 81,
  1820.                     (December, 1980).
  1821.  
  1822.                   - Data Encryption Algorithm - Modes of Operation,
  1823.                     American National Standards Institute.
  1824.                     ANSI X3.106-1983, (May 1983).
  1825.                  "
  1826.     ::= { snmpPrivProtocols 2 }
  1827.  
  1828.  
  1829. -- Textual Conventions ***********************************************
  1830.  
  1831.  
  1832. KeyChange ::=     TEXTUAL-CONVENTION
  1833.    STATUS         current
  1834.    DESCRIPTION
  1835.          "Every definition of an object with this syntax must identify
  1836.           a protocol P, a secret key K, and a hash algorithm H
  1837.           that produces output of L octets.
  1838.  
  1839.           The object's value is a manager-generated, partially-random
  1840.           value which, when modified, causes the value of the secret
  1841.           key K, to be modified via a one-way function.
  1842.  
  1843.           The value of an instance of this object is the concatenation
  1844.           of two components: first a 'random' component and then a
  1845.           'delta' component.
  1846.  
  1847.  
  1848.  
  1849.  
  1850. Blumenthal & Wijnen         Standards Track                    [Page 33]
  1851.  
  1852. RFC 2264                     USM for SNMPv3                 January 1998
  1853.  
  1854.  
  1855.           The lengths of the random and delta components
  1856.           are given by the corresponding value of the protocol P;
  1857.           if P requires K to be a fixed length, the length of both the
  1858.           random and delta components is that fixed length; if P
  1859.           allows the length of K to be variable up to a particular
  1860.           maximum length, the length of the random component is that
  1861.           maximum length and the length of the delta component is any
  1862.           length less than or equal to that maximum length.
  1863.           For example, usmHMACMD5AuthProtocol requires K to be a fixed
  1864.           length of 16 octets and L - of 16 octets.
  1865.           usmHMACSHAAuthProtocol requires K to be a fixed length of
  1866.           20 octets and L - of 20 octets. Other protocols may define
  1867.           other sizes, as deemed appropriate.
  1868.  
  1869.           When a requestor wants to change the old key K to a new
  1870.           key keyNew on a remote entity, the 'random' component is
  1871.           obtained from either a true random generator, or from a
  1872.           pseudorandom generator, and the 'delta' component is
  1873.           computed as follows:
  1874.  
  1875.            - a temporary variable is initialized to the existing value
  1876.              of K;
  1877.            - if the length of the keyNew is greater than L octets,
  1878.              then:
  1879.               - the random component is appended to the value of the
  1880.                 temporary variable, and the result is input to the
  1881.                 the hash algorithm H to produce a digest value, and
  1882.                 the temporary variable is set to this digest value;
  1883.               - the value of the temporary variable is XOR-ed with
  1884.                 the first (next) L-octets (16 octets in case of MD5)
  1885.                 of the keyNew to produce the first (next) L-octets
  1886.                 (16 octets in case of MD5) of the 'delta' component.
  1887.               - the above two steps are repeated until the unused
  1888.                 portion of the delta component is L octets or less,
  1889.            - the random component is appended to the value of the
  1890.              temporary variable, and the result is input to the
  1891.              hash algorithm H to produce a digest value;
  1892.            - this digest value, truncated if necessary to be the same
  1893.              length as the unused portion of the keyNew, is XOR-ed
  1894.              with the unused portion of the keyNew to produce the
  1895.              (final portion of the) 'delta' component.
  1896.  
  1897.            For example, using MD5 as the hash algorithm H:
  1898.  
  1899.               iterations = (lenOfDelta - 1)/16; /* integer division */
  1900.               temp = keyOld;
  1901.               for (i = 0; i < iterations; i++) {
  1902.                   temp = MD5 (temp || random);
  1903.  
  1904.  
  1905.  
  1906. Blumenthal & Wijnen         Standards Track                    [Page 34]
  1907.  
  1908. RFC 2264                     USM for SNMPv3                 January 1998
  1909.  
  1910.  
  1911.                   delta[i*16 .. (i*16)+15] =
  1912.                          temp XOR keyNew[i*16 .. (i*16)+15];
  1913.               }
  1914.               temp = MD5 (temp || random);
  1915.               delta[i*16 .. lenOfDelta-1] =
  1916.                      temp XOR keyNew[i*16 .. lenOfDelta-1];
  1917.  
  1918.           The 'random' and 'delta' components are then concatenated as
  1919.           described above, and the resulting octet string is sent to
  1920.           the receipient as the new value of an instance of this
  1921.           object.
  1922.  
  1923.           At the receiver side, when an instance of this object is set
  1924.           to a new value, then a new value of K is computed as follows:
  1925.  
  1926.            - a temporary variable is initialized to the existing value
  1927.              of K;
  1928.            - if the length of the delta component is greater than L
  1929.              octets, then:
  1930.               - the random component is appended to the value of the
  1931.                 temporary variable, and the result is input to the
  1932.                 the hash algorithm H to produce a digest value, and
  1933.                 the temporary variable is set to this digest value;
  1934.               - the value of the temporary variable is XOR-ed with
  1935.                 the first (next) L-octets (16 octets in case of MD5)
  1936.                 of the delta component to produce the first (next)
  1937.                 L-octets (16 octets in case of MD5) of the new value
  1938.                 of K.
  1939.               - the above two steps are repeated until the unused
  1940.                 portion of the delta component is L octets or less,
  1941.            - the random component is appended to the value of the
  1942.              temporary variable, and the result is input to the
  1943.              hash algorithm H to produce a digest value;
  1944.            - this digest value, truncated if necessary to be the same
  1945.              length as the unused portion of the delta component, is
  1946.              XOR-ed with the unused portion of the delta component to
  1947.              produce the (final portion of the) new value of K.
  1948.  
  1949.            For example, using MD5 as the hash algorithm H:
  1950.  
  1951.               iterations = (lenOfDelta - 1)/16; /* integer division */
  1952.               temp = keyOld;
  1953.               for (i = 0; i < iterations; i++) {
  1954.                   temp = MD5 (temp || random);
  1955.                   keyNew[i*16 .. (i*16)+15] =
  1956.                          temp XOR delta[i*16 .. (i*16)+15];
  1957.               }
  1958.               temp = MD5 (temp || random);
  1959.  
  1960.  
  1961.  
  1962. Blumenthal & Wijnen         Standards Track                    [Page 35]
  1963.  
  1964. RFC 2264                     USM for SNMPv3                 January 1998
  1965.  
  1966.  
  1967.               keyNew[i*16 .. lenOfDelta-1] =
  1968.                      temp XOR delta[i*16 .. lenOfDelta-1];
  1969.  
  1970.           The value of an object with this syntax, whenever it is
  1971.           retrieved by the management protocol, is always the zero
  1972.           length string.
  1973.          "
  1974.     SYNTAX       OCTET STRING
  1975.  
  1976.  
  1977. -- Statistics for the User-based Security Model **********************
  1978.  
  1979.  
  1980. usmStats         OBJECT IDENTIFIER ::= { usmMIBObjects 1 }
  1981.  
  1982.  
  1983. usmStatsUnsupportedSecLevels OBJECT-TYPE
  1984.     SYNTAX       Counter32
  1985.     MAX-ACCESS   read-only
  1986.     STATUS       current
  1987.     DESCRIPTION "The total number of packets received by the SNMP
  1988.                  engine which were dropped because they requested a
  1989.                  securityLevel that was unknown to the SNMP engine
  1990.                  or otherwise unavailable.
  1991.                 "
  1992.     ::= { usmStats 1 }
  1993.  
  1994. usmStatsNotInTimeWindows OBJECT-TYPE
  1995.     SYNTAX       Counter32
  1996.     MAX-ACCESS   read-only
  1997.     STATUS       current
  1998.     DESCRIPTION "The total number of packets received by the SNMP
  1999.                  engine which were dropped because they appeared
  2000.                  outside of the authoritative SNMP engine's window.
  2001.                 "
  2002.     ::= { usmStats 2 }
  2003.  
  2004. usmStatsUnknownUserNames OBJECT-TYPE
  2005.     SYNTAX       Counter32
  2006.     MAX-ACCESS   read-only
  2007.     STATUS       current
  2008.     DESCRIPTION "The total number of packets received by the SNMP
  2009.                  engine which were dropped because they referenced a
  2010.                  user that was not known to the SNMP engine.
  2011.                 "
  2012.     ::= { usmStats 3 }
  2013.  
  2014. usmStatsUnknownEngineIDs OBJECT-TYPE
  2015.  
  2016.  
  2017.  
  2018. Blumenthal & Wijnen         Standards Track                    [Page 36]
  2019.  
  2020. RFC 2264                     USM for SNMPv3                 January 1998
  2021.  
  2022.  
  2023.     SYNTAX       Counter32
  2024.     MAX-ACCESS   read-only
  2025.     STATUS       current
  2026.     DESCRIPTION "The total number of packets received by the SNMP
  2027.                  engine which were dropped because they referenced an
  2028.                  snmpEngineID that was not known to the SNMP engine.
  2029.                 "
  2030.     ::= { usmStats 4 }
  2031.  
  2032. usmStatsWrongDigests OBJECT-TYPE
  2033.     SYNTAX       Counter32
  2034.     MAX-ACCESS   read-only
  2035.     STATUS       current
  2036.     DESCRIPTION "The total number of packets received by the SNMP
  2037.                  engine which were dropped because they didn't
  2038.                  contain the expected digest value.
  2039.                 "
  2040.     ::= { usmStats 5 }
  2041.  
  2042. usmStatsDecryptionErrors OBJECT-TYPE
  2043.     SYNTAX       Counter32
  2044.     MAX-ACCESS   read-only
  2045.     STATUS       current
  2046.     DESCRIPTION "The total number of packets received by the SNMP
  2047.                  engine which were dropped because they could not be
  2048.                  decrypted.
  2049.                 "
  2050.     ::= { usmStats 6 }
  2051.  
  2052. -- The usmUser Group ************************************************
  2053.  
  2054. usmUser          OBJECT IDENTIFIER ::= { usmMIBObjects 2 }
  2055.  
  2056. usmUserSpinLock  OBJECT-TYPE
  2057.     SYNTAX       TestAndIncr
  2058.     MAX-ACCESS   read-write
  2059.     STATUS       current
  2060.     DESCRIPTION "An advisory lock used to allow several cooperating
  2061.                  Command Generator Applications to coordinate their
  2062.                  use of facilities to alter secrets in the
  2063.                  usmUserTable.
  2064.                 "
  2065.     ::= { usmUser 1 }
  2066.  
  2067. -- The table of valid users for the User-based Security Model ********
  2068.  
  2069. usmUserTable     OBJECT-TYPE
  2070.     SYNTAX       SEQUENCE OF UsmUserEntry
  2071.  
  2072.  
  2073.  
  2074. Blumenthal & Wijnen         Standards Track                    [Page 37]
  2075.  
  2076. RFC 2264                     USM for SNMPv3                 January 1998
  2077.  
  2078.  
  2079.     MAX-ACCESS   not-accessible
  2080.     STATUS       current
  2081.     DESCRIPTION "The table of users configured in the SNMP engine's
  2082.                  Local Configuration Datastore (LCD)."
  2083.     ::= { usmUser 2 }
  2084.  
  2085. usmUserEntry     OBJECT-TYPE
  2086.     SYNTAX       UsmUserEntry
  2087.     MAX-ACCESS   not-accessible
  2088.     STATUS       current
  2089.     DESCRIPTION "A user configured in the SNMP engine's Local
  2090.                  Configuration Datastore (LCD) for the User-based
  2091.                  Security Model.
  2092.                 "
  2093.     INDEX       { usmUserEngineID,
  2094.                   usmUserName
  2095.                 }
  2096.     ::= { usmUserTable 1 }
  2097.  
  2098. UsmUserEntry ::= SEQUENCE
  2099.     {
  2100.         usmUserEngineID         SnmpEngineID,
  2101.         usmUserName             SnmpAdminString,
  2102.         usmUserSecurityName     SnmpAdminString,
  2103.         usmUserCloneFrom        RowPointer,
  2104.         usmUserAuthProtocol     AutonomousType,
  2105.         usmUserAuthKeyChange    KeyChange,
  2106.         usmUserOwnAuthKeyChange KeyChange,
  2107.         usmUserPrivProtocol     AutonomousType,
  2108.         usmUserPrivKeyChange    KeyChange,
  2109.         usmUserOwnPrivKeyChange KeyChange,
  2110.         usmUserPublic           OCTET STRING,
  2111.         usmUserStorageType      StorageType,
  2112.         usmUserStatus           RowStatus
  2113.     }
  2114.  
  2115. usmUserEngineID  OBJECT-TYPE
  2116.     SYNTAX       SnmpEngineID
  2117.     MAX-ACCESS   not-accessible
  2118.     STATUS       current
  2119.     DESCRIPTION "An SNMP engine's administratively-unique identifier.
  2120.  
  2121.                  In a simple agent, this value is always that agent's
  2122.                  own snmpEngineID value.
  2123.  
  2124.                  The value can also take the value of the snmpEngineID
  2125.                  of a remote SNMP engine with which this user can
  2126.                  communicate.
  2127.  
  2128.  
  2129.  
  2130. Blumenthal & Wijnen         Standards Track                    [Page 38]
  2131.  
  2132. RFC 2264                     USM for SNMPv3                 January 1998
  2133.  
  2134.  
  2135.                 "
  2136.     ::= { usmUserEntry 1 }
  2137.  
  2138. usmUserName      OBJECT-TYPE
  2139.     SYNTAX       SnmpAdminString (SIZE(1..32))
  2140.     MAX-ACCESS   not-accessible
  2141.     STATUS       current
  2142.     DESCRIPTION "A human readable string representing the name of
  2143.                  the user.
  2144.  
  2145.                  This is the (User-based Security) Model dependent
  2146.                  security ID.
  2147.                 "
  2148.     ::= { usmUserEntry 2 }
  2149.  
  2150. usmUserSecurityName OBJECT-TYPE
  2151.     SYNTAX       SnmpAdminString
  2152.     MAX-ACCESS   read-only
  2153.     STATUS       current
  2154.     DESCRIPTION "A human readable string representing the user in
  2155.                  Security Model independent format.
  2156.  
  2157.                  The default transformation of the User-based Security
  2158.                  Model dependent security ID to the securityName and
  2159.                  vice versa is the identity function so that the
  2160.                  securityName is the same as the userName.
  2161.                 "
  2162.     ::= { usmUserEntry 3 }
  2163.  
  2164. usmUserCloneFrom OBJECT-TYPE
  2165.     SYNTAX       RowPointer
  2166.     MAX-ACCESS   read-create
  2167.     STATUS       current
  2168.     DESCRIPTION "A pointer to another conceptual row in this
  2169.                  usmUserTable.  The user in this other conceptual
  2170.                  row is called the clone-from user.
  2171.  
  2172.                  When a new user is created (i.e., a new conceptual
  2173.                  row is instantiated in this table), the privacy and
  2174.                  authentication parameters of the new user are cloned
  2175.                  from its clone-from user.
  2176.  
  2177.                  The first time an instance of this object is set by
  2178.                  a management operation (either at or after its
  2179.                  instantiation), the cloning process is invoked.
  2180.                  Subsequent writes are successful but invoke no
  2181.                  action to be taken by the receiver.
  2182.                  The cloning process fails with an 'inconsistentName'
  2183.  
  2184.  
  2185.  
  2186. Blumenthal & Wijnen         Standards Track                    [Page 39]
  2187.  
  2188. RFC 2264                     USM for SNMPv3                 January 1998
  2189.  
  2190.  
  2191.                  error if the conceptual row representing the
  2192.                  clone-from user is not in an active state when the
  2193.                  cloning process is invoked.
  2194.  
  2195.                  Cloning also causes the initial values of the secret
  2196.                  authentication key and the secret encryption key of
  2197.                  the new user to be set to the same value as the
  2198.                  corresponding secret of the clone-from user.
  2199.  
  2200.                  When this object is read, the ZeroDotZero OID
  2201.                  is returned.
  2202.                 "
  2203.     ::= { usmUserEntry 4 }
  2204.  
  2205. usmUserAuthProtocol OBJECT-TYPE
  2206.     SYNTAX       AutonomousType
  2207.     MAX-ACCESS   read-create
  2208.     STATUS       current
  2209.     DESCRIPTION "An indication of whether messages sent on behalf of
  2210.                  this user to/from the SNMP engine identified by
  2211.                  usmUserEngineID, can be authenticated, and if so,
  2212.                  the type of authentication protocol which is used.
  2213.  
  2214.                  An instance of this object is created concurrently
  2215.                  with the creation of any other object instance for
  2216.                  the same user (i.e., as part of the processing of
  2217.                  the set operation which creates the first object
  2218.                  instance in the same conceptual row).  Once created,
  2219.                  the value of an instance of this object can not be
  2220.                  changed.
  2221.  
  2222.                  If a set operation tries to set a value for an unknown
  2223.                  or unsupported protocol, then a wrongValue error must
  2224.                  be returned.
  2225.                 "
  2226.     DEFVAL      { usmHMACMD5AuthProtocol }
  2227.     ::= { usmUserEntry 5 }
  2228.  
  2229. usmUserAuthKeyChange OBJECT-TYPE
  2230.     SYNTAX       KeyChange   -- typically (SIZE (0..32))
  2231.     MAX-ACCESS   read-create
  2232.     STATUS       current
  2233.     DESCRIPTION "An object, which when modified, causes the secret
  2234.                  authentication key used for messages sent on behalf
  2235.                  of this user to/from the SNMP engine identified by
  2236.                  usmUserEngineID, to be modified via a one-way
  2237.                  function.
  2238.  
  2239.  
  2240.  
  2241.  
  2242. Blumenthal & Wijnen         Standards Track                    [Page 40]
  2243.  
  2244. RFC 2264                     USM for SNMPv3                 January 1998
  2245.  
  2246.  
  2247.                  The associated protocol is the usmUserAuthProtocol.
  2248.                  The associated secret key is the user's secret
  2249.                  authentication key (authKey). The associated hash
  2250.                  algorithm is the algorithm used by the user's
  2251.                  usmUserAuthProtocol.
  2252.  
  2253.                  When creating a new user, it is an 'inconsistentName'
  2254.                  error for a Set operation to refer to this object
  2255.                  unless it is previously or concurrently initialized
  2256.                  through a set operation on the corresponding value
  2257.                  of usmUserCloneFrom.
  2258.                 "
  2259.     DEFVAL      { ''H }    -- the empty string
  2260.     ::= { usmUserEntry 6 }
  2261.  
  2262. usmUserOwnAuthKeyChange OBJECT-TYPE
  2263.     SYNTAX       KeyChange  -- typically (SIZE (0..32))
  2264.     MAX-ACCESS   read-create
  2265.     STATUS       current
  2266.     DESCRIPTION "Behaves exactly as usmUserAuthKeyChange, with one
  2267.                  notable difference: in order for the Set operation
  2268.                  to succeed, the usmUserName of the operation
  2269.                  requester must match the usmUserName that
  2270.                  indexes the row which is targeted by this
  2271.                  operation.
  2272.  
  2273.                  The idea here is that access to this column can be
  2274.                  public, since it will only allow a user to change
  2275.                  his own secret authentication key (authKey).
  2276.                 "
  2277.     DEFVAL      { ''H }    -- the empty string
  2278.     ::= { usmUserEntry 7 }
  2279.  
  2280. usmUserPrivProtocol OBJECT-TYPE
  2281.     SYNTAX       AutonomousType
  2282.     MAX-ACCESS   read-create
  2283.     STATUS       current
  2284.     DESCRIPTION "An indication of whether messages sent on behalf of
  2285.                  this user to/from the SNMP engine identified by
  2286.                  usmUserEngineID, can be protected from disclosure,
  2287.                  and if so, the type of privacy protocol which is used.
  2288.  
  2289.                  An instance of this object is created concurrently
  2290.                  with the creation of any other object instance for
  2291.                  the same user (i.e., as part of the processing of
  2292.                  the set operation which creates the first object
  2293.                  instance in the same conceptual row).  Once created,
  2294.                  the value of an instance of this object can not be
  2295.  
  2296.  
  2297.  
  2298. Blumenthal & Wijnen         Standards Track                    [Page 41]
  2299.  
  2300. RFC 2264                     USM for SNMPv3                 January 1998
  2301.  
  2302.  
  2303.                  changed.
  2304.  
  2305.                  If a set operation tries to set a value for an unknown
  2306.                  or unsupported protocol, then a wrongValue error must
  2307.                  be returned.
  2308.                 "
  2309.     DEFVAL      { usmNoPrivProtocol }
  2310.     ::= { usmUserEntry 8 }
  2311.  
  2312. usmUserPrivKeyChange OBJECT-TYPE
  2313.     SYNTAX       KeyChange  -- typically (SIZE (0..32))
  2314.     MAX-ACCESS   read-create
  2315.     STATUS       current
  2316.     DESCRIPTION "An object, which when modified, causes the secret
  2317.                  encryption key used for messages sent on behalf
  2318.                  of this user to/from the SNMP engine identified by
  2319.                  usmUserEngineID, to be modified via a one-way
  2320.                  function.
  2321.  
  2322.                  The associated protocol is the usmUserPrivProtocol.
  2323.                  The associated secret key is the user's secret
  2324.                  privacy key (privKey). The associated hash
  2325.                  algorithm is the algorithm used by the user's
  2326.                  usmUserAuthProtocol.
  2327.  
  2328.                  When creating a new user, it is an 'inconsistentName'
  2329.                  error for a set operation to refer to this object
  2330.                  unless it is previously or concurrently initialized
  2331.                  through a set operation on the corresponding value
  2332.                  of usmUserCloneFrom.
  2333.                 "
  2334.     DEFVAL      { ''H }    -- the empty string
  2335.     ::= { usmUserEntry 9 }
  2336.  
  2337. usmUserOwnPrivKeyChange OBJECT-TYPE
  2338.     SYNTAX       KeyChange  -- typically (SIZE (0..32))
  2339.     MAX-ACCESS   read-create
  2340.     STATUS       current
  2341.     DESCRIPTION "Behaves exactly as usmUserPrivKeyChange, with one
  2342.                  notable difference: in order for the Set operation
  2343.                  to succeed, the usmUserName of the operation
  2344.                  requester must match the usmUserName that indexes
  2345.                  the row which is targeted by this operation.
  2346.  
  2347.                  The idea here is that access to this column can be
  2348.                  public, since it will only allow a user to change
  2349.                  his own secret privacy key (privKey).
  2350.                 "
  2351.  
  2352.  
  2353.  
  2354. Blumenthal & Wijnen         Standards Track                    [Page 42]
  2355.  
  2356. RFC 2264                     USM for SNMPv3                 January 1998
  2357.  
  2358.  
  2359.     DEFVAL      { ''H }    -- the empty string
  2360.     ::= { usmUserEntry 10 }
  2361.  
  2362. usmUserPublic    OBJECT-TYPE
  2363.     SYNTAX       OCTET STRING (SIZE(0..32))
  2364.     MAX-ACCESS   read-create
  2365.     STATUS       current
  2366.     DESCRIPTION "A publicly-readable value which is written as part
  2367.                  of the procedure for changing a user's secret
  2368.                  authentication and/or privacy key, and later read to
  2369.                  determine whether the change of the secret was
  2370.                  effected.
  2371.                 "
  2372.     DEFVAL      { ''H }  -- the empty string
  2373.     ::= { usmUserEntry 11 }
  2374.  
  2375. usmUserStorageType OBJECT-TYPE
  2376.     SYNTAX       StorageType
  2377.     MAX-ACCESS   read-create
  2378.     STATUS       current
  2379.     DESCRIPTION "The storage type for this conceptual row.
  2380.  
  2381.                  Conceptual rows having the value 'permanent'
  2382.                  must allow write-access at a minimum to:
  2383.  
  2384.                  - usmUserAuthKeyChange, usmUserOwnAuthKeyChange
  2385.                    and usmUserPublic for a user who employs
  2386.                    authentication, and
  2387.                  - usmUserPrivKeyChange, usmUserOwnPrivKeyChange
  2388.                    and usmUserPublic for a user who employs
  2389.                    privacy.
  2390.  
  2391.                  Note that any user who employs authentication or
  2392.                  privacy must allow its secret(s) to be updated and
  2393.                  thus cannot be 'readOnly'.
  2394.                 "
  2395.     DEFVAL      { nonVolatile }
  2396.     ::= { usmUserEntry 12 }
  2397.  
  2398. usmUserStatus    OBJECT-TYPE
  2399.     SYNTAX       RowStatus
  2400.     MAX-ACCESS   read-create
  2401.     STATUS       current
  2402.     DESCRIPTION "The status of this conceptual row.
  2403.  
  2404.                  Until instances of all corresponding columns are
  2405.                  appropriately configured, the value of the
  2406.                  corresponding instance of the usmUserStatus column
  2407.  
  2408.  
  2409.  
  2410. Blumenthal & Wijnen         Standards Track                    [Page 43]
  2411.  
  2412. RFC 2264                     USM for SNMPv3                 January 1998
  2413.  
  2414.  
  2415.                  is 'notReady'.
  2416.  
  2417.                  In particular, a newly created row cannot be made
  2418.                  active until the corresponding usmUserCloneFrom,
  2419.                  usmUserAuthKeyChange, usmUserOwnAuthKeyChange,
  2420.                  usmUserPrivKeyChange and usmUserOwnPrivKeyChange
  2421.                  have all been set.
  2422.  
  2423.                  The  RowStatus TC [RFC1903] requires that this
  2424.                  DESCRIPTION clause states under which circumstances
  2425.                  other objects in this row can be modified:
  2426.  
  2427.                  The value of this object has no effect on whether
  2428.                  other objects in this conceptual row can be modified.
  2429.                 "
  2430.     ::= { usmUserEntry 13 }
  2431.  
  2432. -- Conformance Information *******************************************
  2433.  
  2434. usmMIBCompliances OBJECT IDENTIFIER ::= { usmMIBConformance 1 }
  2435. usmMIBGroups      OBJECT IDENTIFIER ::= { usmMIBConformance 2 }
  2436.  
  2437. -- Compliance statements
  2438.  
  2439. usmMIBCompliance MODULE-COMPLIANCE
  2440.     STATUS       current
  2441.     DESCRIPTION "The compliance statement for SNMP engines which
  2442.                  implement the SNMP-USER-BASED-SM-MIB.
  2443.                 "
  2444.  
  2445.     MODULE       -- this module
  2446.         MANDATORY-GROUPS { usmMIBBasicGroup }
  2447.  
  2448.         OBJECT           usmUserAuthProtocol
  2449.         MIN-ACCESS       read-only
  2450.         DESCRIPTION     "Write access is not required."
  2451.  
  2452.         OBJECT           usmUserPrivProtocol
  2453.         MIN-ACCESS       read-only
  2454.         DESCRIPTION     "Write access is not required."
  2455.  
  2456.     ::= { usmMIBCompliances 1 }
  2457.  
  2458. -- Units of compliance
  2459. usmMIBBasicGroup OBJECT-GROUP
  2460.     OBJECTS     {
  2461.                   usmStatsUnsupportedSecLevels,
  2462.                   usmStatsNotInTimeWindows,
  2463.  
  2464.  
  2465.  
  2466. Blumenthal & Wijnen         Standards Track                    [Page 44]
  2467.  
  2468. RFC 2264                     USM for SNMPv3                 January 1998
  2469.  
  2470.  
  2471.                   usmStatsUnknownUserNames,
  2472.                   usmStatsUnknownEngineIDs,
  2473.                   usmStatsWrongDigests,
  2474.                   usmStatsDecryptionErrors,
  2475.                   usmUserSpinLock,
  2476.                   usmUserSecurityName,
  2477.                   usmUserCloneFrom,
  2478.                   usmUserAuthProtocol,
  2479.                   usmUserAuthKeyChange,
  2480.                   usmUserOwnAuthKeyChange,
  2481.                   usmUserPrivProtocol,
  2482.                   usmUserPrivKeyChange,
  2483.                   usmUserOwnPrivKeyChange,
  2484.                   usmUserPublic,
  2485.                   usmUserStorageType,
  2486.                   usmUserStatus
  2487.                 }
  2488.     STATUS       current
  2489.     DESCRIPTION "A collection of objects providing for configuration
  2490.                  of an SNMP engine which implements the SNMP
  2491.                  User-based Security Model.
  2492.                 "
  2493.     ::= { usmMIBGroups 1 }
  2494.  
  2495. END
  2496.  
  2497. 6.  HMAC-MD5-96 Authentication Protocol
  2498.  
  2499.    This section describes the HMAC-MD5-96 authentication protocol.  This
  2500.    authentication protocol is the first defined for the User-based
  2501.    Security Model. It uses MD5 hash-function which is described in
  2502.    [MD5], in HMAC mode described in [RFC2104], truncating the output to
  2503.    96 bits.
  2504.  
  2505.    This protocol is identified by usmHMACMD5AuthProtocol.
  2506.  
  2507.    Over time, other authentication protocols may be defined either as a
  2508.    replacement of this protocol or in addition to this protocol.
  2509.  
  2510. 6.1.  Mechanisms
  2511.  
  2512.    - In support of data integrity, a message digest algorithm is
  2513.      required.  A digest is calculated over an appropriate portion of an
  2514.      SNMP message and included as part of the message sent to the
  2515.      recipient.
  2516.  
  2517.  
  2518.  
  2519.  
  2520.  
  2521.  
  2522. Blumenthal & Wijnen         Standards Track                    [Page 45]
  2523.  
  2524. RFC 2264                     USM for SNMPv3                 January 1998
  2525.  
  2526.  
  2527.    - In support of data origin authentication and data integrity,
  2528.      a secret value is prepended to SNMP message prior to computing the
  2529.      digest; the calculated digest is partially inserted into the SNMP
  2530.      message prior to transmission, and the prepended value is not
  2531.      transmitted.  The secret value is shared by all SNMP engines
  2532.      authorized to originate messages on behalf of the appropriate user.
  2533.  
  2534. 6.1.1.  Digest Authentication Mechanism
  2535.  
  2536.    The Digest Authentication Mechanism defined in this memo provides
  2537.    for:
  2538.  
  2539.    - verification of the integrity of a received message, i.e., the
  2540.      message received is the message sent.
  2541.  
  2542.      The integrity of the message is protected by computing a digest
  2543.      over an appropriate portion of the message.  The digest is computed
  2544.      by the originator of the message, transmitted with the message, and
  2545.      verified by the recipient of the message.
  2546.  
  2547.    - verification of the user on whose behalf the message was generated.
  2548.  
  2549.      A secret value known only to SNMP engines authorized to generate
  2550.      messages on behalf of a user is used in HMAC mode (see [RFC2104]).
  2551.      It also recommends the hash-function output used as Message
  2552.      Authentication Code, to be truncated.
  2553.  
  2554.    This protocol uses the MD5 [MD5] message digest algorithm.  A 128-bit
  2555.    MD5 digest is calculated in a special (HMAC) way over the designated
  2556.    portion of an SNMP message and the first 96 bits of this digest is
  2557.    included as part of the message sent to the recipient. The size of
  2558.    the digest carried in a message is 12 octets. The size of the private
  2559.    authentication key (the secret) is 16 octets. For the details see
  2560.    section 6.3.
  2561.  
  2562. 6.2.  Elements of the Digest Authentication Protocol
  2563.  
  2564.    This section contains definitions required to realize the
  2565.    authentication module defined in this section of this memo.
  2566.  
  2567. 6.2.1.  Users
  2568.  
  2569.    Authentication using this authentication protocol makes use of a
  2570.    defined set of userNames. For any user on whose behalf a message must
  2571.    be authenticated at a particular SNMP engine, that SNMP engine must
  2572.    have knowledge of that user. An SNMP engine that wishes to
  2573.  
  2574.  
  2575.  
  2576.  
  2577.  
  2578. Blumenthal & Wijnen         Standards Track                    [Page 46]
  2579.  
  2580. RFC 2264                     USM for SNMPv3                 January 1998
  2581.  
  2582.  
  2583.    communicate with another SNMP engine must also have knowledge of a
  2584.    user known to that engine, including knowledge of the applicable
  2585.    attributes of that user.
  2586.  
  2587.    A user and its attributes are defined as follows:
  2588.  
  2589.    <userName>
  2590.      A string representing the name of the user.
  2591.    <authKey>
  2592.      A user's secret key to be used when calculating a digest.
  2593.      It MUST be 16 octets long for MD5.
  2594.  
  2595. 6.2.2.  msgAuthoritativeEngineID
  2596.  
  2597.    The msgAuthoritativeEngineID value contained in an authenticated
  2598.    message specifies the authoritative SNMP engine for that particular
  2599.    message (see the definition of SnmpEngineID in the SNMP Architecture
  2600.    document [RFC2261]).
  2601.  
  2602.    The user's (private) authentication key is normally different at each
  2603.    authoritative SNMP engine and so the snmpEngineID is used to select
  2604.    the proper key for the authentication process.
  2605.  
  2606. 6.2.3.  SNMP Messages Using this Authentication Protocol
  2607.  
  2608.    Messages using this authentication protocol carry a
  2609.    msgAuthenticationParameters field as part of the
  2610.    msgSecurityParameters.  For this protocol, the
  2611.    msgAuthenticationParameters field is the serialized OCTET STRING
  2612.    representing the first 12 octets of the HMAC-MD5-96 output done over
  2613.    the wholeMsg.
  2614.  
  2615.    The digest is calculated over the wholeMsg so if a message is
  2616.    authenticated, that also means that all the fields in the message are
  2617.    intact and have not been tampered with.
  2618.  
  2619. 6.2.4.  Services provided by the HMAC-MD5-96 Authentication Module
  2620.  
  2621.    This section describes the inputs and outputs that the HMAC-MD5-96
  2622.    Authentication module expects and produces when the User-based
  2623.    Security module calls the HMAC-MD5-96 Authentication module for
  2624.    services.
  2625.  
  2626. 6.2.4.1.  Services for Generating an Outgoing SNMP Message
  2627.  
  2628.    The HMAC-MD5-96 authentication protocol assumes that the selection of
  2629.    the authKey is done by the caller and that the caller passes the
  2630.    secret key to be used.
  2631.  
  2632.  
  2633.  
  2634. Blumenthal & Wijnen         Standards Track                    [Page 47]
  2635.  
  2636. RFC 2264                     USM for SNMPv3                 January 1998
  2637.  
  2638.  
  2639.    Upon completion the authentication module returns statusInformation
  2640.    and, if the message digest was correctly calculated, the wholeMsg
  2641.    with the digest inserted at the proper place. The abstract service
  2642.    primitive is:
  2643.  
  2644.    statusInformation =              -- success or failure
  2645.      authenticateOutgoingMsg(
  2646.      IN   authKey                   -- secret key for authentication
  2647.      IN   wholeMsg                  -- unauthenticated complete message
  2648.      OUT  authenticatedWholeMsg     -- complete authenticated message
  2649.           )
  2650.  
  2651.    The abstract data elements are:
  2652.  
  2653.      statusInformation
  2654.        An indication of whether the authentication process was
  2655.        successful.  If not it is an indication of the problem.
  2656.      authKey
  2657.        The secret key to be used by the authentication algorithm.
  2658.        The length of this key MUST be 16 octets.
  2659.      wholeMsg
  2660.        The message to be authenticated.
  2661.      authenticatedWholeMsg
  2662.        The authenticated message (including inserted digest) on output.
  2663.  
  2664.    Note, that authParameters field is filled by the authentication
  2665.    module and this field should be already present in the wholeMsg
  2666.    before the Message Authentication Code (MAC) is generated.
  2667.  
  2668. 6.2.4.2.  Services for Processing an Incoming SNMP Message
  2669.  
  2670.    The HMAC-MD5-96 authentication protocol assumes that the selection of
  2671.    the authKey is done by the caller and that the caller passes the
  2672.    secret key to be used.
  2673.  
  2674.    Upon completion the authentication module returns statusInformation
  2675.    and, if the message digest was correctly calculated, the wholeMsg as
  2676.    it was processed. The abstract service primitive is:
  2677.  
  2678.    statusInformation =              -- success or failure
  2679.      authenticateIncomingMsg(
  2680.      IN   authKey                   -- secret key for authentication
  2681.      IN   authParameters            -- as received on the wire
  2682.      IN   wholeMsg                  -- as received on the wire
  2683.      OUT  authenticatedWholeMsg     -- complete authenticated message
  2684.        )
  2685.  
  2686.    The abstract data elements are:
  2687.  
  2688.  
  2689.  
  2690. Blumenthal & Wijnen         Standards Track                    [Page 48]
  2691.  
  2692. RFC 2264                     USM for SNMPv3                 January 1998
  2693.  
  2694.  
  2695.      statusInformation
  2696.        An indication of whether the authentication process was
  2697.        successful.  If not it is an indication of the problem.
  2698.      authKey
  2699.        The secret key to be used by the authentication algorithm.
  2700.        The length of this key MUST be 16 octets.
  2701.      authParameters
  2702.        The authParameters from the incoming message.
  2703.      wholeMsg
  2704.        The message to be authenticated on input and the authenticated
  2705.        message on output.
  2706.      authenticatedWholeMsg
  2707.        The whole message after the authentication check is complete.
  2708.  
  2709. 6.3.  Elements of Procedure
  2710.  
  2711.    This section describes the procedures for the HMAC-MD5-96
  2712.    authentication protocol.
  2713.  
  2714. 6.3.1.  Processing an Outgoing Message
  2715.  
  2716.    This section describes the procedure followed by an SNMP engine
  2717.    whenever it must authenticate an outgoing message using the
  2718.    usmHMACMD5AuthProtocol.
  2719.  
  2720.    1) The msgAuthenticationParameters field is set to the
  2721.       serialization, according to the rules in [RFC1906], of an OCTET
  2722.       STRING containing 12 zero octets.
  2723.  
  2724.    2) From the secret authKey, two keys K1 and K2 are derived:
  2725.  
  2726.          a) extend the authKey to 64 octets by appending 48 zero
  2727.             octets; save it as extendedAuthKey
  2728.          b) obtain IPAD by replicating the octet 0x36 64 times;
  2729.          c) obtain K1 by XORing extendedAuthKey with IPAD;
  2730.          d) obtain OPAD by replicating the octet 0x5C 64 times;
  2731.          e) obtain K2 by XORing extendedAuthKey with OPAD.
  2732.  
  2733.    4) Prepend K1 to the wholeMsg and calculate MD5 digest over it
  2734.       according to [MD5].
  2735.  
  2736.    5) Prepend K2 to the result of the step 4 and calculate MD5 digest
  2737.       over it according to [MD5]. Take the first 12 octets of the final
  2738.       digest - this is Message Authentication Code (MAC).
  2739.  
  2740.    6) Replace the msgAuthenticationParameters field with MAC obtained
  2741.       in the step 5.
  2742.  
  2743.  
  2744.  
  2745.  
  2746. Blumenthal & Wijnen         Standards Track                    [Page 49]
  2747.  
  2748. RFC 2264                     USM for SNMPv3                 January 1998
  2749.  
  2750.  
  2751.    7) The authenticatedWholeMsg is then returned to the caller
  2752.       together with statusInformation indicating success.
  2753.  
  2754. 6.3.2.  Processing an Incoming Message
  2755.  
  2756.    This section describes the procedure followed by an SNMP engine
  2757.    whenever it must authenticate an incoming message using the
  2758.    usmHMACMD5AuthProtocol.
  2759.  
  2760.    1)  If the digest received in the msgAuthenticationParameters field
  2761.        is not 12 octets long, then an failure and an errorIndication
  2762.        (authenticationError) is returned to the calling module.
  2763.  
  2764.    2)  The MAC received in the msgAuthenticationParameters field
  2765.        is saved.
  2766.  
  2767.    3)  The digest in the msgAuthenticationParameters field is replaced
  2768.        by the 12 zero octets.
  2769.  
  2770.    4)  From the secret authKey, two keys K1 and K2 are derived:
  2771.  
  2772.          a) extend the authKey to 64 octets by appending 48 zero
  2773.             octets; save it as extendedAuthKey
  2774.          b) obtain IPAD by replicating the octet 0x36 64 times;
  2775.          c) obtain K1 by XORing extendedAuthKey with IPAD;
  2776.          d) obtain OPAD by replicating the octet 0x5C 64 times;
  2777.          e) obtain K2 by XORing extendedAuthKey with OPAD.
  2778.  
  2779.    5)  The MAC is calculated over the wholeMsg:
  2780.  
  2781.          a) prepend K1 to the wholeMsg and calculate the MD5 digest
  2782.             over it;
  2783.          b) prepend K2 to the result of step 5.a and calculate the
  2784.             MD5 digest over it;
  2785.          c) first 12 octets of the result of step 5.b is the MAC.
  2786.  
  2787.        The msgAuthenticationParameters field is replaced with the MAC
  2788.        value that was saved in step 2.
  2789.  
  2790.    6)  Then the newly calculated MAC is compared with the MAC
  2791.        saved in step 2. If they do not match, then an failure and an
  2792.        errorIndication (authenticationFailure) is returned to the
  2793.        calling module.
  2794.  
  2795.    7)  The authenticatedWholeMsg and statusInformation indicating
  2796.        success are then returned to the caller.
  2797.  
  2798.  
  2799.  
  2800.  
  2801.  
  2802. Blumenthal & Wijnen         Standards Track                    [Page 50]
  2803.  
  2804. RFC 2264                     USM for SNMPv3                 January 1998
  2805.  
  2806.  
  2807. 7.  HMAC-SHA-96 Authentication Protocol
  2808.  
  2809.    This section describes the HMAC-SHA-96 authentication protocol.  This
  2810.    protocol uses the SHA hash-function which is described in [SHA-NIST],
  2811.    in HMAC mode described in [RFC2104], truncating the output to 96
  2812.    bits.
  2813.  
  2814.    This protocol is identified by usmHMACSHAAuthProtocol.
  2815.  
  2816.    Over time, other authentication protocols may be defined either as a
  2817.    replacement of this protocol or in addition to this protocol.
  2818.  
  2819. 7.1.  Mechanisms
  2820.  
  2821.    - In support of data integrity, a message digest algorithm is
  2822.      required.  A digest is calculated over an appropriate portion of an
  2823.      SNMP message and included as part of the message sent to the
  2824.      recipient.
  2825.  
  2826.    - In support of data origin authentication and data integrity,
  2827.      a secret value is prepended to the SNMP message prior to computing
  2828.      the digest; the calculated digest is then partially inserted into
  2829.      the message prior to transmission. The prepended secret is not
  2830.      transmitted.  The secret value is shared by all SNMP engines
  2831.      authorized to originate messages on behalf of the appropriate user.
  2832.  
  2833. 7.1.1.  Digest Authentication Mechanism
  2834.  
  2835.    The Digest Authentication Mechanism defined in this memo provides
  2836.    for:
  2837.  
  2838.    - verification of the integrity of a received message, i.e., the
  2839.      the message received is the message sent.
  2840.  
  2841.      The integrity of the message is protected by computing a digest
  2842.      over an appropriate portion of the message.  The digest is computed
  2843.      by the originator of the message, transmitted with the message, and
  2844.      verified by the recipient of the message.
  2845.  
  2846.    - verification of the user on whose behalf the message was generated.
  2847.  
  2848.      A secret value known only to SNMP engines authorized to generate
  2849.      messages on behalf of a user is used in HMAC mode (see [RFC2104]).
  2850.      It also recommends the hash-function output used as Message
  2851.      Authentication Code, to be truncated.
  2852.  
  2853.  
  2854.  
  2855.  
  2856.  
  2857.  
  2858. Blumenthal & Wijnen         Standards Track                    [Page 51]
  2859.  
  2860. RFC 2264                     USM for SNMPv3                 January 1998
  2861.  
  2862.  
  2863.    This mechanism uses the SHA [SHA-NIST] message digest algorithm.  A
  2864.    160-bit SHA digest is calculated in a special (HMAC) way over the
  2865.    designated portion of an SNMP message and the first 96 bits of this
  2866.    digest is included as part of the message sent to the recipient. The
  2867.    size of the digest carried in a message is 12 octets. The size of the
  2868.    private authentication key (the secret) is 20 octets. For the details
  2869.    see section 7.3.
  2870.  
  2871. 7.2.  Elements of the HMAC-SHA-96 Authentication Protocol
  2872.  
  2873.    This section contains definitions required to realize the
  2874.    authentication module defined in this section of this memo.
  2875.  
  2876. 7.2.1.  Users
  2877.  
  2878.    Authentication using this authentication protocol makes use of a
  2879.    defined set of userNames.  For any user on whose behalf a message
  2880.    must be authenticated at a particular SNMP engine, that SNMP engine
  2881.    must have knowledge of that user.  An SNMP engine that wishes to
  2882.    communicate with another SNMP engine must also have knowledge of a
  2883.    user known to that engine, including knowledge of the applicable
  2884.    attributes of that user.
  2885.  
  2886.    A user and its attributes are defined as follows:
  2887.  
  2888.    <userName>
  2889.      A string representing the name of the user.
  2890.    <authKey>
  2891.      A user's secret key to be used when calculating a digest.
  2892.      It MUST be 20 octets long for SHA.
  2893.  
  2894. 7.2.2.  msgAuthoritativeEngineID
  2895.  
  2896.    The msgAuthoritativeEngineID value contained in an authenticated
  2897.    message specifies the authoritative SNMP engine for that particular
  2898.    message (see the definition of SnmpEngineID in the SNMP Architecture
  2899.    document [RFC2261]).
  2900.  
  2901.    The user's (private) authentication key is normally different at each
  2902.    authoritative SNMP engine and so the snmpEngineID is used to select
  2903.    the proper key for the authentication process.
  2904.  
  2905.  
  2906.  
  2907.  
  2908.  
  2909.  
  2910.  
  2911.  
  2912.  
  2913.  
  2914. Blumenthal & Wijnen         Standards Track                    [Page 52]
  2915.  
  2916. RFC 2264                     USM for SNMPv3                 January 1998
  2917.  
  2918.  
  2919. 7.2.3.  SNMP Messages Using this Authentication Protocol
  2920.  
  2921.    Messages using this authentication protocol carry a
  2922.    msgAuthenticationParameters field as part of the
  2923.    msgSecurityParameters. For this protocol, the
  2924.    msgAuthenticationParameters field is the serialized OCTET STRING
  2925.    representing the first 12 octets of HMAC-SHA-96 output done over the
  2926.    wholeMsg.
  2927.  
  2928.    The digest is calculated over the wholeMsg so if a message is
  2929.    authenticated, that also means that all the fields in the message are
  2930.    intact and have not been tampered with.
  2931.  
  2932. 7.2.4.  Services provided by the HMAC-SHA-96 Authentication Module
  2933.  
  2934.    This section describes the inputs and outputs that the HMAC-SHA-96
  2935.    Authentication module expects and produces when the User-based
  2936.    Security module calls the HMAC-SHA-96 Authentication module for
  2937.    services.
  2938.  
  2939. 7.2.4.1.  Services for Generating an Outgoing SNMP Message
  2940.  
  2941.    HMAC-SHA-96 authentication protocol assumes that the selection of the
  2942.    authKey is done by the caller and that the caller passes the secret
  2943.    key to be used.
  2944.  
  2945.    Upon completion the authentication module returns statusInformation
  2946.    and, if the message digest was correctly calculated, the wholeMsg
  2947.    with the digest inserted at the proper place. The abstract service
  2948.    primitive is:
  2949.  
  2950.    statusInformation =              -- success or failure
  2951.      authenticateOutgoingMsg(
  2952.      IN   authKey                   -- secret key for authentication
  2953.      IN   wholeMsg                  -- unauthenticated complete message
  2954.      OUT  authenticatedWholeMsg     -- complete authenticated message
  2955.           )
  2956.  
  2957.    The abstract data elements are:
  2958.  
  2959.      statusInformation
  2960.        An indication of whether the authentication process was
  2961.        successful.  If not it is an indication of the problem.
  2962.      authKey
  2963.        The secret key to be used by the authentication algorithm.
  2964.        The length of this key MUST be 20 octets.
  2965.      wholeMsg
  2966.        The message to be authenticated.
  2967.  
  2968.  
  2969.  
  2970. Blumenthal & Wijnen         Standards Track                    [Page 53]
  2971.  
  2972. RFC 2264                     USM for SNMPv3                 January 1998
  2973.  
  2974.  
  2975.      authenticatedWholeMsg
  2976.        The authenticated message (including inserted digest) on output.
  2977.  
  2978.    Note, that authParameters field is filled by the authentication
  2979.    module and this field should be already present in the wholeMsg
  2980.    before the Message Authentication Code (MAC) is generated.
  2981.  
  2982. 7.2.4.2.  Services for Processing an Incoming SNMP Message
  2983.  
  2984.    HMAC-SHA-96 authentication protocol assumes that the selection of the
  2985.    authKey is done by the caller and that the caller passes the secret
  2986.    key to be used.
  2987.  
  2988.    Upon completion the authentication module returns statusInformation
  2989.    and, if the message digest was correctly calculated, the wholeMsg as
  2990.    it was processed. The abstract service primitive is:
  2991.  
  2992.    statusInformation =              -- success or failure
  2993.      authenticateIncomingMsg(
  2994.      IN   authKey                   -- secret key for authentication
  2995.      IN   authParameters            -- as received on the wire
  2996.      IN   wholeMsg                  -- as received on the wire
  2997.      OUT  authenticatedWholeMsg     -- complete authenticated message
  2998.        )
  2999.  
  3000.    The abstract data elements are:
  3001.  
  3002.      statusInformation
  3003.        An indication of whether the authentication process was
  3004.        successful.  If not it is an indication of the problem.
  3005.      authKey
  3006.        The secret key to be used by the authentication algorithm.
  3007.        The length of this key MUST be 20 octets.
  3008.      authParameters
  3009.        The authParameters from the incoming message.
  3010.      wholeMsg
  3011.        The message to be authenticated on input and the authenticated
  3012.        message on output.
  3013.      authenticatedWholeMsg
  3014.        The whole message after the authentication check is complete.
  3015.  
  3016. 7.3.  Elements of Procedure
  3017.  
  3018.    This section describes the procedures for the HMAC-SHA-96
  3019.    authentication protocol.
  3020.  
  3021.  
  3022.  
  3023.  
  3024.  
  3025.  
  3026. Blumenthal & Wijnen         Standards Track                    [Page 54]
  3027.  
  3028. RFC 2264                     USM for SNMPv3                 January 1998
  3029.  
  3030.  
  3031. 7.3.1.  Processing an Outgoing Message
  3032.  
  3033.    This section describes the procedure followed by an SNMP engine
  3034.    whenever it must authenticate an outgoing message using the
  3035.    usmHMACSHAAuthProtocol.
  3036.  
  3037.    1) The msgAuthenticationParameters field is set to the
  3038.       serialization, according to the rules in [RFC1906], of an OCTET
  3039.       STRING containing 12 zero octets.
  3040.  
  3041.    2) From the secret authKey, two keys K1 and K2 are derived:
  3042.  
  3043.          a) extend the authKey to 64 octets by appending 44 zero
  3044.             octets; save it as extendedAuthKey
  3045.          b) obtain IPAD by replicating the octet 0x36 64 times;
  3046.          c) obtain K1 by XORing extendedAuthKey with IPAD;
  3047.          d) obtain OPAD by replicating the octet 0x5C 64 times;
  3048.          e) obtain K2 by XORing extendedAuthKey with OPAD.
  3049.  
  3050.    3) Prepend K1 to the wholeMsg and calculate the SHA digest over it
  3051.       according to [SHA-NIST].
  3052.  
  3053.    4) Prepend K2 to the result of the step 4 and calculate SHA digest
  3054.       over it according to [SHA-NIST]. Take the first 12 octets of the
  3055.       final digest - this is Message Authentication Code (MAC).
  3056.  
  3057.    5) Replace the msgAuthenticationParameters field with MAC obtained
  3058.       in the step 5.
  3059.  
  3060.    6) The authenticatedWholeMsg is then returned to the caller
  3061.       together with statusInformation indicating success.
  3062.  
  3063. 7.3.2.  Processing an Incoming Message
  3064.  
  3065.    This section describes the procedure followed by an SNMP engine
  3066.    whenever it must authenticate an incoming message using the
  3067.    usmHMACSHAAuthProtocol.
  3068.  
  3069.    1)  If the digest received in the msgAuthenticationParameters field
  3070.        is not 12 octets long, then an failure and an errorIndication
  3071.        (authenticationError) is returned to the calling module.
  3072.  
  3073.    2)  The MAC received in the msgAuthenticationParameters field
  3074.        is saved.
  3075.  
  3076.    3)  The digest in the msgAuthenticationParameters field is
  3077.        replaced by the 12 zero octets.
  3078.  
  3079.  
  3080.  
  3081.  
  3082. Blumenthal & Wijnen         Standards Track                    [Page 55]
  3083.  
  3084. RFC 2264                     USM for SNMPv3                 January 1998
  3085.  
  3086.  
  3087.    4)  From the secret authKey, two keys K1 and K2 are derived:
  3088.  
  3089.          a) extend the authKey to 64 octets by appending 44 zero
  3090.             octets; save it as extendedAuthKey
  3091.          b) obtain IPAD by replicating the octet 0x36 64 times;
  3092.          c) obtain K1 by XORing extendedAuthKey with IPAD;
  3093.          d) obtain OPAD by replicating the octet 0x5C 64 times;
  3094.          e) obtain K2 by XORing extendedAuthKey with OPAD.
  3095.  
  3096.    5)  The MAC is calculated over the wholeMsg:
  3097.  
  3098.          a) prepend K1 to the wholeMsg and calculate the SHA digest
  3099.             over it;
  3100.          b) prepend K2 to the result of step 5.a and calculate the
  3101.             SHA digest over it;
  3102.          c) first 12 octets of the result of step 5.b is the MAC.
  3103.  
  3104.        The msgAuthenticationParameters field is replaced with the MAC
  3105.        value that was saved in step 2.
  3106.  
  3107.    6)  The the newly calculated MAC is compared with the MAC saved in
  3108.        step 2. If they do not match, then a failure and an
  3109.        errorIndication (authenticationFailure) are returned to the
  3110.        calling module.
  3111.  
  3112.    7)  The authenticatedWholeMsg and statusInformation indicating
  3113.        success are then returned to the caller.
  3114.  
  3115. 8.  CBC-DES Symmetric Encryption Protocol
  3116.  
  3117.    This section describes the CBC-DES Symmetric Encryption Protocol.
  3118.    This protocol is the first privacy protocol defined for the User-
  3119.    based Security Model.
  3120.  
  3121.    This protocol is identified by usmDESPrivProtocol.
  3122.  
  3123.    Over time, other privacy protocols may be defined either as a
  3124.    replacement of this protocol or in addition to this protocol.
  3125.  
  3126. 8.1.  Mechanisms
  3127.  
  3128.    - In support of data confidentiality, an encryption algorithm is
  3129.      required.  An appropriate portion of the message is encrypted prior
  3130.      to being transmitted. The User-based Security Model specifies that
  3131.      the scopedPDU is the portion of the message that needs to be
  3132.      encrypted.
  3133.  
  3134.  
  3135.  
  3136.  
  3137.  
  3138. Blumenthal & Wijnen         Standards Track                    [Page 56]
  3139.  
  3140. RFC 2264                     USM for SNMPv3                 January 1998
  3141.  
  3142.  
  3143.    - A secret value in combination with a timeliness value is used
  3144.      to create the en/decryption key and the initialization vector.  The
  3145.      secret value is shared by all SNMP engines authorized to originate
  3146.      messages on behalf of the appropriate user.
  3147.  
  3148. 8.1.1.  Symmetric Encryption Protocol
  3149.  
  3150.    The Symmetric Encryption Protocol defined in this memo provides
  3151.    support for data confidentiality.  The designated portion of an SNMP
  3152.    message is encrypted and included as part of the message sent to the
  3153.    recipient.
  3154.  
  3155.    Two organizations have published specifications defining the DES: the
  3156.    National Institute of Standards and Technology (NIST) [DES-NIST] and
  3157.    the American National Standards Institute [DES-ANSI].  There is a
  3158.    companion Modes of Operation specification for each definition
  3159.    ([DESO-NIST] and [DESO-ANSI], respectively).
  3160.  
  3161.    The NIST has published three additional documents that implementors
  3162.    may find useful.
  3163.  
  3164.    - There is a document with guidelines for implementing and using
  3165.      the DES, including functional specifications for the DES and its
  3166.      modes of operation [DESG-NIST].
  3167.  
  3168.    - There is a specification of a validation test suite for the DES
  3169.      [DEST-NIST].  The suite is designed to test all aspects of the DES
  3170.      and is useful for pinpointing specific problems.
  3171.  
  3172.    - There is a specification of a maintenance test for the DES
  3173.      [DESM-NIST].  The test utilizes a minimal amount of data and
  3174.      processing to test all components of the DES.  It provides a simple
  3175.      yes-or-no indication of correct operation and is useful to run as
  3176.      part of an initialization step, e.g., when a computer re-boots.
  3177.  
  3178. 8.1.1.1.  DES key and Initialization Vector.
  3179.  
  3180.    The first 8 octets of the 16-octet secret (private privacy key) are
  3181.    used as a DES key.  Since DES uses only 56 bits, the Least
  3182.    Significant Bit in each octet is disregarded.
  3183.  
  3184.    The Initialization Vector for encryption is obtained using the
  3185.    following procedure.
  3186.  
  3187.    The last 8 octets of the 16-octet secret (private privacy key) are
  3188.    used as pre-IV.
  3189.  
  3190.  
  3191.  
  3192.  
  3193.  
  3194. Blumenthal & Wijnen         Standards Track                    [Page 57]
  3195.  
  3196. RFC 2264                     USM for SNMPv3                 January 1998
  3197.  
  3198.  
  3199.    In order to ensure that the IV for two different packets encrypted by
  3200.    the same key, are not the same (i.e., the IV does not repeat) we need
  3201.    to "salt" the pre-IV with something unique per packet.  An 8-octet
  3202.    string is used as the "salt".  The concatenation of the generating
  3203.    SNMP engine's 32-bit snmpEngineBoots and a local 32-bit integer, that
  3204.    the encryption engine maintains, is input to the "salt".  The 32-bit
  3205.    integer is initialized to an arbitrary value at boot time.
  3206.  
  3207.    The 32-bit snmpEngineBoots is converted to the first 4 octets (Most
  3208.    Significant Byte first) of our "salt".  The 32-bit integer is then
  3209.    converted to the last 4 octet (Most Significant Byte first) of our
  3210.    "salt".  The resulting "salt" is then XOR-ed with the pre-IV. The 8-
  3211.    octet "salt" is then put into the privParameters field encoded as an
  3212.    OCTET STRING.  The "salt" integer is then modified.  We recommend
  3213.    that it be incremented by one and wrap when it reaches the maximum
  3214.    value.
  3215.  
  3216.    How exactly the value of the "salt" (and thus of the IV) varies, is
  3217.    an implementation issue, as long as the measures are taken to avoid
  3218.    producing a duplicate IV.
  3219.  
  3220.    The "salt" must be placed in the privParameters field to enable the
  3221.    receiving entity to compute the correct IV and to decrypt the
  3222.    message.
  3223.  
  3224. 8.1.1.2.  Data Encryption.
  3225.  
  3226.    The data to be encrypted is treated as sequence of octets. Its length
  3227.    should be an integral multiple of 8 - and if it is not, the data is
  3228.    padded at the end as necessary.  The actual pad value is irrelevant.
  3229.  
  3230.    The data is encrypted in Cipher Block Chaining mode.
  3231.  
  3232.    The plaintext is divided into 64-bit blocks.
  3233.  
  3234.    The plaintext for each block is XOR-ed with the ciphertext of the
  3235.    previous block, the result is encrypted and the output of the
  3236.    encryption is the ciphertext for the block.  This procedure is
  3237.    repeated until there are no more plaintext blocks.
  3238.  
  3239.    For the very first block, the Initialization Vector is used instead
  3240.    of the ciphertext of the previous block.
  3241.  
  3242.  
  3243.  
  3244.  
  3245.  
  3246.  
  3247.  
  3248.  
  3249.  
  3250. Blumenthal & Wijnen         Standards Track                    [Page 58]
  3251.  
  3252. RFC 2264                     USM for SNMPv3                 January 1998
  3253.  
  3254.  
  3255. 8.1.1.3.  Data Decryption
  3256.  
  3257.    Before decryption, the encrypted data length is verified.  If the
  3258.    length of the OCTET STRING to be decrypted is not an integral
  3259.    multiple of 8 octets, the decryption process is halted and an
  3260.    appropriate exception noted.  When decrypting, the padding is
  3261.    ignored.
  3262.  
  3263.    The first ciphertext block is decrypted, the decryption output is
  3264.    XOR-ed with the Initialization Vector, and the result is the first
  3265.    plaintext block.
  3266.  
  3267.    For each subsequent block, the ciphertext block is decrypted, the
  3268.    decryption output is XOR-ed with the previous ciphertext block and
  3269.    the result is the plaintext block.
  3270.  
  3271. 8.2.  Elements of the DES Privacy Protocol
  3272.  
  3273.    This section contains definitions required to realize the privacy
  3274.    module defined by this memo.
  3275.  
  3276. 8.2.1.  Users
  3277.  
  3278.    Data en/decryption using this Symmetric Encryption Protocol makes use
  3279.    of a defined set of userNames.  For any user on whose behalf a
  3280.    message must be en/decrypted at a particular SNMP engine, that SNMP
  3281.    engine must have knowledge of that user.  An SNMP engine that wishes
  3282.    to communicate with another SNMP engine must also have knowledge of a
  3283.    user known to that SNMP engine, including knowledge of the applicable
  3284.    attributes of that user.
  3285.  
  3286.    A user and its attributes are defined as follows:
  3287.  
  3288.    <userName>
  3289.      An octet string representing the name of the user.
  3290.    <privKey>
  3291.      A user's secret key to be used as input for the DES key and IV.
  3292.      The length of this key MUST be 16 octets.
  3293.  
  3294. 8.2.2.  msgAuthoritativeEngineID
  3295.  
  3296.    The msgAuthoritativeEngineID value contained in an authenticated
  3297.    message specifies the authoritative SNMP engine for that particular
  3298.    message (see the definition of SnmpEngineID in the SNMP Architecture
  3299.    document [RFC2261]).
  3300.  
  3301.  
  3302.  
  3303.  
  3304.  
  3305.  
  3306. Blumenthal & Wijnen         Standards Track                    [Page 59]
  3307.  
  3308. RFC 2264                     USM for SNMPv3                 January 1998
  3309.  
  3310.  
  3311.    The user's (private) privacy key is normally different at each
  3312.    authoritative SNMP engine and so the snmpEngineID is used to select
  3313.    the proper key for the en/decryption process.
  3314.  
  3315. 8.2.3.  SNMP Messages Using this Privacy Protocol
  3316.  
  3317.    Messages using this privacy protocol carry a msgPrivacyParameters
  3318.    field as part of the msgSecurityParameters. For this protocol, the
  3319.    msgPrivacyParameters field is the serialized OCTET STRING
  3320.    representing the "salt" that was used to create the IV.
  3321.  
  3322. 8.2.4.  Services provided by the DES Privacy Module
  3323.  
  3324.    This section describes the inputs and outputs that the DES Privacy
  3325.    module expects and produces when the User-based Security module
  3326.    invokes the DES Privacy module for services.
  3327.  
  3328. 8.2.4.1.  Services for Encrypting Outgoing Data
  3329.  
  3330.    This DES privacy protocol assumes that the selection of the privKey
  3331.    is done by the caller and that the caller passes the secret key to be
  3332.    used.
  3333.  
  3334.    Upon completion the privacy module returns statusInformation and, if
  3335.    the encryption process was successful, the encryptedPDU and the
  3336.    msgPrivacyParameters encoded as an OCTET STRING.  The abstract
  3337.    service primitive is:
  3338.  
  3339.    statusInformation =              -- success of failure
  3340.      encryptData(
  3341.      IN    encryptKey               -- secret key for encryption
  3342.      IN    dataToEncrypt            -- data to encrypt (scopedPDU)
  3343.      OUT   encryptedData            -- encrypted data (encryptedPDU)
  3344.      OUT   privParameters           -- filled in by service provider
  3345.            )
  3346.  
  3347.    The abstract data elements are:
  3348.  
  3349.      statusInformation
  3350.        An indication of the success or failure of the encryption
  3351.        process.  In case of failure, it is an indication of the error.
  3352.      encryptKey
  3353.        The secret key to be used by the encryption algorithm.
  3354.        The length of this key MUST be 16 octets.
  3355.      dataToEncrypt
  3356.        The data that must be encrypted.
  3357.      encryptedData
  3358.        The encrypted data upon successful completion.
  3359.  
  3360.  
  3361.  
  3362. Blumenthal & Wijnen         Standards Track                    [Page 60]
  3363.  
  3364. RFC 2264                     USM for SNMPv3                 January 1998
  3365.  
  3366.  
  3367.      privParameters
  3368.        The privParameters encoded as an OCTET STRING.
  3369.  
  3370. 8.2.4.2.  Services for Decrypting Incoming Data
  3371.  
  3372.    This DES privacy protocol assumes that the selection of the privKey
  3373.    is done by the caller and that the caller passes the secret key to be
  3374.    used.
  3375.  
  3376.    Upon completion the privacy module returns statusInformation and, if
  3377.    the decryption process was successful, the scopedPDU in plain text.
  3378.    The abstract service primitive is:
  3379.  
  3380.    statusInformation =
  3381.      decryptData(
  3382.      IN    decryptKey               -- secret key for decryption
  3383.      IN    privParameters           -- as received on the wire
  3384.      IN    encryptedData            -- encrypted data (encryptedPDU)
  3385.      OUT   decryptedData            -- decrypted data (scopedPDU)
  3386.            )
  3387.  
  3388.    The abstract data elements are:
  3389.  
  3390.      statusInformation
  3391.        An indication whether the data was successfully decrypted
  3392.        and if not an indication of the error.
  3393.      decryptKey
  3394.        The secret key to be used by the decryption algorithm.
  3395.        The length of this key MUST be 16 octets.
  3396.      privParameters
  3397.        The "salt" to be used to calculate the IV.
  3398.      encryptedData
  3399.        The data to be decrypted.
  3400.      decryptedData
  3401.        The decrypted data.
  3402.  
  3403. 8.3.  Elements of Procedure.
  3404.  
  3405.    This section describes the procedures for the DES privacy protocol.
  3406.  
  3407. 8.3.1.  Processing an Outgoing Message
  3408.  
  3409.    This section describes the procedure followed by an SNMP engine
  3410.    whenever it must encrypt part of an outgoing message using the
  3411.    usmDESPrivProtocol.
  3412.  
  3413.    1)  The secret cryptKey is used to construct the DES encryption key,
  3414.        the "salt" and the DES pre-IV (as described in section 8.1.1.1).
  3415.  
  3416.  
  3417.  
  3418. Blumenthal & Wijnen         Standards Track                    [Page 61]
  3419.  
  3420. RFC 2264                     USM for SNMPv3                 January 1998
  3421.  
  3422.  
  3423.    2)  The privParameters field is set to the serialization according
  3424.        to the rules in [RFC1906] of an OCTET STRING representing the the
  3425.        "salt" string.
  3426.  
  3427.    3)  The scopedPDU is encrypted (as described in section 8.1.1.2)
  3428.        and the encrypted data is serialized according to the rules in
  3429.        [RFC1906] as an OCTET STRING.
  3430.  
  3431.    4)  The serialized OCTET STRING representing the encrypted
  3432.        scopedPDU together with the privParameters and statusInformation
  3433.        indicating success is returned to the calling module.
  3434.  
  3435. 8.3.2.  Processing an Incoming Message
  3436.  
  3437.    This section describes the procedure followed by an SNMP engine
  3438.    whenever it must decrypt part of an incoming message using the
  3439.    usmDESPrivProtocol.
  3440.  
  3441.    1)  If the privParameters field is not an 8-octet OCTET STRING,
  3442.        then an error indication (decryptionError) is returned to the
  3443.        calling module.
  3444.  
  3445.    2)  The "salt" is extracted from the privParameters field.
  3446.  
  3447.    3)  The secret cryptKey and the "salt" are then used to construct the
  3448.        DES decryption key and pre-IV (as described in section 8.1.1.1).
  3449.  
  3450.    4)  The encryptedPDU is then decrypted (as described in
  3451.        section 8.1.1.3).
  3452.  
  3453.    5)  If the encryptedPDU cannot be decrypted, then an error
  3454.        indication (decryptionError) is returned to the calling module.
  3455.  
  3456.    6)  The decrypted scopedPDU and statusInformation indicating
  3457.        success are returned to the calling module.
  3458.  
  3459. 9.  Intellectual Property
  3460.  
  3461.    The IETF takes no position regarding the validity or scope of any
  3462.    intellectual property or other rights that might be claimed to
  3463.    pertain to the implementation or use of the technology described in
  3464.    this document or the extent to which any license under such rights
  3465.    might or might not be available; neither does it represent that it
  3466.    has made any effort to identify any such rights.  Information on the
  3467.    IETF's procedures with respect to rights in standards-track and
  3468.    standards-related documentation can be found in BCP-11.  Copies of
  3469.    claims of rights made available for publication and any assurances of
  3470.    licenses to be made available, or the result of an attempt made to
  3471.  
  3472.  
  3473.  
  3474. Blumenthal & Wijnen         Standards Track                    [Page 62]
  3475.  
  3476. RFC 2264                     USM for SNMPv3                 January 1998
  3477.  
  3478.  
  3479.    obtain a general license or permission for the use of such
  3480.    proprietary rights by implementors or users of this specification can
  3481.    be obtained from the IETF Secretariat.
  3482.  
  3483.    The IETF invites any interested party to bring to its attention any
  3484.    copyrights, patents or patent applications, or other proprietary
  3485.    rights which may cover technology that may be required to practice
  3486.    this standard.  Please address the information to the IETF Executive
  3487.    Director.
  3488.  
  3489. 10.  Acknowledgements
  3490.  
  3491.    This document is the result of the efforts of the SNMPv3 Working
  3492.    Group.  Some special thanks are in order to the following SNMPv3 WG
  3493.    members:
  3494.  
  3495.       Dave Battle (SNMP Research, Inc.)
  3496.       Uri Blumenthal (IBM T.J. Watson Research Center)
  3497.       Jeff Case (SNMP Research, Inc.)
  3498.       John Curran (BBN)
  3499.       T. Max Devlin (Hi-TECH Connections)
  3500.       John Flick (Hewlett Packard)
  3501.       David Harrington (Cabletron Systems Inc.)
  3502.       N.C. Hien (IBM T.J. Watson Research Center)
  3503.       Dave Levi (SNMP Research, Inc.)
  3504.       Louis A Mamakos (UUNET Technologies Inc.)
  3505.       Paul Meyer (Secure Computing Corporation)
  3506.       Keith McCloghrie (Cisco Systems)
  3507.       Russ Mundy (Trusted Information Systems, Inc.)
  3508.       Bob Natale (ACE*COMM Corporation)
  3509.       Mike O'Dell (UUNET Technologies Inc.)
  3510.       Dave Perkins (DeskTalk)
  3511.       Peter Polkinghorne (Brunel University)
  3512.       Randy Presuhn (BMC Software, Inc.)
  3513.       David Reid (SNMP Research, Inc.)
  3514.       Shawn Routhier (Epilogue)
  3515.       Juergen Schoenwaelder (TU Braunschweig)
  3516.       Bob Stewart (Cisco Systems)
  3517.       Bert Wijnen (IBM T.J. Watson Research Center)
  3518.  
  3519.    The document is based on recommendations of the IETF Security and
  3520.    Administrative Framework Evolution for SNMP Advisory Team.  Members
  3521.    of that Advisory Team were:
  3522.  
  3523.       David Harrington (Cabletron Systems Inc.)
  3524.       Jeff Johnson (Cisco Systems)
  3525.       David Levi (SNMP Research Inc.)
  3526.       John Linn (Openvision)
  3527.  
  3528.  
  3529.  
  3530. Blumenthal & Wijnen         Standards Track                    [Page 63]
  3531.  
  3532. RFC 2264                     USM for SNMPv3                 January 1998
  3533.  
  3534.  
  3535.       Russ Mundy (Trusted Information Systems) chair
  3536.       Shawn Routhier (Epilogue)
  3537.       Glenn Waters (Nortel)
  3538.       Bert Wijnen (IBM T. J. Watson Research Center)
  3539.  
  3540.    As recommended by the Advisory Team and the SNMPv3 Working Group
  3541.    Charter, the design incorporates as much as practical from previous
  3542.    RFCs and drafts. As a result, special thanks are due to the authors
  3543.    of previous designs known as SNMPv2u and SNMPv2*:
  3544.  
  3545.       Jeff Case (SNMP Research, Inc.)
  3546.       David Harrington (Cabletron Systems Inc.)
  3547.       David Levi (SNMP Research, Inc.)
  3548.       Keith McCloghrie (Cisco Systems)
  3549.       Brian O'Keefe (Hewlett Packard)
  3550.       Marshall T. Rose (Dover Beach Consulting)
  3551.       Jon Saperia (BGS Systems Inc.)
  3552.       Steve Waldbusser (International Network Services)
  3553.       Glenn W. Waters (Bell-Northern Research Ltd.)
  3554.  
  3555. 11.  Security Considerations
  3556.  
  3557. 11.1.  Recommended Practices
  3558.  
  3559.    This section describes practices that contribute to the secure,
  3560.    effective operation of the mechanisms defined in this memo.
  3561.  
  3562.    - An SNMP engine must discard SNMP Response messages that do not
  3563.      correspond to any currently outstanding Request message. It is the
  3564.      responsibility of the Message Processing module to take care of
  3565.      this. For example it can use a msgID for that.
  3566.  
  3567.      An SNMP Command Generator Application must discard any Response PDU
  3568.      for which there is no currently outstanding Request PDU; for
  3569.      example for SNMPv2 [RFC1905] PDUs, the request-id component in the
  3570.      PDU can be used to correlate Responses to outstanding Requests.
  3571.  
  3572.      Although it would be typical for an SNMP engine and an SNMP Command
  3573.      Generator Application to do this as a matter of course, when using
  3574.      these security protocols it is significant due to the possibility
  3575.      of message duplication (malicious or otherwise).
  3576.  
  3577.    - If an SNMP engine uses a msgID for correlating Response messages
  3578.      to outstanding Request messages, then it MUST use different msgIDs
  3579.      in all such Request messages that it sends out during a Time Window
  3580.      (150 seconds) period.
  3581.  
  3582.  
  3583.  
  3584.  
  3585.  
  3586. Blumenthal & Wijnen         Standards Track                    [Page 64]
  3587.  
  3588. RFC 2264                     USM for SNMPv3                 January 1998
  3589.  
  3590.  
  3591.      A Command Generator or Notification Originator Application MUST use
  3592.      different request-ids in all Request PDUs that it sends out during
  3593.      a TimeWindow (150 seconds) period.
  3594.  
  3595.      This must be done to protect against the possibility of message
  3596.      duplication (malicious or otherwise).
  3597.  
  3598.      For example, starting operations with a msgID and/or request-id
  3599.      value of zero is not a good idea.  Initializing them with an
  3600.      unpredictable number (so they do not start out the same after each
  3601.      reboot) and then incrementing by one would be acceptable.
  3602.  
  3603.    - An SNMP engine should perform time synchronization using
  3604.      authenticated messages in order to protect against the possibility
  3605.      of message duplication (malicious or otherwise).
  3606.  
  3607.    - When sending state altering messages to a managed authoritative
  3608.      SNMP engine, a Command Generator Application should delay sending
  3609.      successive messages to that managed SNMP engine until a positive
  3610.      acknowledgement is received for the previous message or until the
  3611.      previous message expires.
  3612.  
  3613.      No message ordering is imposed by the SNMP. Messages may be
  3614.      received in any order relative to their time of generation and each
  3615.      will be processed in the ordered received.  Note that when an
  3616.      authenticated message is sent to a managed SNMP engine, it will be
  3617.      valid for a period of time of approximately 150 seconds under
  3618.      normal circumstances, and is subject to replay during this period.
  3619.      Indeed, an SNMP engine and SNMP Command Generator Applications must
  3620.      cope with the loss and re-ordering of messages resulting from
  3621.      anomalies in the network as a matter of course.
  3622.  
  3623.      However, a managed object, snmpSetSerialNo [RFC1907], is
  3624.      specifically defined for use with SNMP Set operations in order to
  3625.      provide a mechanism to ensure that the processing of SNMP messages
  3626.      occurs in a specific order.
  3627.  
  3628.    - The frequency with which the secrets of a User-based Security
  3629.      Model user should be changed is indirectly related to the frequency
  3630.      of their use.
  3631.  
  3632.      Protecting the secrets from disclosure is critical to the overall
  3633.      security of the protocols.  Frequent use of a secret provides a
  3634.      continued source of data that may be useful to a cryptanalyst in
  3635.      exploiting known or perceived weaknesses in an algorithm.  Frequent
  3636.      changes to the secret avoid this vulnerability.
  3637.  
  3638.  
  3639.  
  3640.  
  3641.  
  3642. Blumenthal & Wijnen         Standards Track                    [Page 65]
  3643.  
  3644. RFC 2264                     USM for SNMPv3                 January 1998
  3645.  
  3646.  
  3647.      Changing a secret after each use is generally regarded as the most
  3648.      secure practice, but a significant amount of overhead may be
  3649.      associated with that approach.
  3650.  
  3651.      Note, too, in a local environment the threat of disclosure may be
  3652.      less significant, and as such the changing of secrets may be less
  3653.      frequent.  However, when public data networks are used as the
  3654.      communication paths, more caution is prudent.
  3655.  
  3656. 11.2  Defining Users
  3657.  
  3658.    The mechanisms defined in this document employ the notion of users on
  3659.    whose behalf messages are sent.  How "users" are defined is subject
  3660.    to the security policy of the network administration.  For example,
  3661.    users could be individuals (e.g., "joe" or "jane"), or a particular
  3662.    role (e.g., "operator" or "administrator"), or a combination (e.g.,
  3663.    "joe-operator", "jane-operator" or "joe-admin").  Furthermore, a user
  3664.    may be a logical entity, such as an SNMP Application or a set of SNMP
  3665.    Applications, acting on behalf of an individual or role, or set of
  3666.    individuals, or set of roles, including combinations.
  3667.  
  3668.    Appendix A describes an algorithm for mapping a user "password" to a
  3669.    16 octet value for use as either a user's authentication key or
  3670.    privacy key (or both).  Note however, that using the same password
  3671.    (and therefore the same key) for both authentication and privacy is
  3672.    very poor security practice and should be strongly discouraged.
  3673.    Passwords are often generated, remembered, and input by a human.
  3674.    Human-generated passwords may be less than the 16 octets required by
  3675.    the authentication and privacy protocols, and brute force attacks can
  3676.    be quite easy on a relatively short ASCII character set.  Therefore,
  3677.    the algorithm is Appendix A performs a transformation on the
  3678.    password.  If the Appendix A algorithm is used, SNMP implementations
  3679.    (and SNMP configuration applications) must ensure that passwords are
  3680.    at least 8 characters in length.
  3681.  
  3682.    Because the Appendix A algorithm uses such passwords (nearly)
  3683.    directly, it is very important that they not be easily guessed.  It
  3684.    is suggested that they be composed of mixed-case alphanumeric and
  3685.    punctuation characters that don't form words or phrases that might be
  3686.    found in a dictionary.  Longer passwords improve the security of the
  3687.    system.  Users may wish to input multiword phrases to make their
  3688.    password string longer while ensuring that it is memorable.
  3689.  
  3690.    Since it is infeasible for human users to maintain different
  3691.    passwords for every SNMP engine, but security requirements strongly
  3692.    discourage having the same key for more than one SNMP engine, the
  3693.    User-based Security Model employs a compromise proposed in
  3694.    [Localized-key].  It derives the user keys for the SNMP engines from
  3695.  
  3696.  
  3697.  
  3698. Blumenthal & Wijnen         Standards Track                    [Page 66]
  3699.  
  3700. RFC 2264                     USM for SNMPv3                 January 1998
  3701.  
  3702.  
  3703.    user's password in such a way that it is practically impossible to
  3704.    either determine the user's password, or user's key for another SNMP
  3705.    engine from any combination of user's keys on SNMP engines.
  3706.  
  3707.    Note however, that if user's password is disclosed, then key
  3708.    localization will not help and network security may be compromised in
  3709.    this case. Therefore a user's password or non-localized key MUST NOT
  3710.    be stored on a managed device/node. Instead the localized key SHALL
  3711.    be stored (if at all) , so that, in case a device does get
  3712.    compromised, no other managed or managing devices get compromised.
  3713.  
  3714. 11.3.  Conformance
  3715.  
  3716.    To be termed a "Secure SNMP implementation" based on the User-based
  3717.    Security Model, an SNMP implementation MUST:
  3718.  
  3719.    - implement one or more Authentication Protocol(s). The HMAC-MD5-96
  3720.      and HMAC-SHA-96 Authentication Protocols defined in this memo are
  3721.      examples of such protocols.
  3722.  
  3723.    - to the maximum extent possible, prohibit access to the secret(s)
  3724.      of each user about which it maintains information in a Local
  3725.      Configuration Datastore (LCD) under all circumstances except as
  3726.      required to generate and/or validate SNMP messages with respect to
  3727.      that user.
  3728.  
  3729.    - implement the key-localization mechanism.
  3730.  
  3731.    - implement the SNMP-USER-BASED-SM-MIB.
  3732.  
  3733.    In addition, an authoritative SNMP engine SHOULD provide initial
  3734.    configuration in accordance with Appendix A.1.
  3735.  
  3736.    Implementation of a Privacy Protocol (the DES Symmetric Encryption
  3737.    Protocol defined in this memo is one such protocol) is optional.
  3738.  
  3739. 12.  References
  3740.  
  3741.    [RFC1321] Rivest, R.,  "Message Digest Algorithm MD5",
  3742.       RFC 1321, April 1992.
  3743.  
  3744.    [RFC1903] Case, J., McCloghrie, K., Rose, M. and S. Waldbusser,
  3745.       "Textual Conventions for Version 2 of the Simple Network
  3746.       Management Protocol (SNMPv2)", RFC 1903, January 1996.
  3747.  
  3748.    [RFC1905] Case, J., McCloghrie, K., Rose, M. and S. Waldbusser,
  3749.       "Protocol Operations for Version 2 of the Simple Network
  3750.       Management Protocol (SNMPv2)", RFC 1905, January 1996.
  3751.  
  3752.  
  3753.  
  3754. Blumenthal & Wijnen         Standards Track                    [Page 67]
  3755.  
  3756. RFC 2264                     USM for SNMPv3                 January 1998
  3757.  
  3758.  
  3759.    [RFC1906] Case, J., McCloghrie, K., Rose, M. and S. Waldbusser,
  3760.       "Transport Mappings for Version 2 of the Simple Network Management
  3761.       Protocol (SNMPv2)", RFC 1906, January 1996.
  3762.  
  3763.    [RFC1907] Case, J., McCloghrie, K., Rose, M. and S. Waldbusser,
  3764.       "Management Information Base for Version 2 of the Simple Network
  3765.       Management Protocol (SNMPv2)", RFC 1907 January 1996.
  3766.  
  3767.    [RFC2104] Krawczyk, H., Bellare, M., and R. Canetti, "HMAC:
  3768.       Keyed-Hashing  for Message Authentication", RFC 2104, February
  3769.       1997.
  3770.  
  3771.    [RFC2028] Hovey, R., and S. Bradner, "The Organizations Involved in
  3772.       the IETF Standards Process", BCP 11, RFC 2028, October 1996.
  3773.  
  3774.    [RFC2119] Bradner, S., "Key words for use in RFCs to Indicate
  3775.       Requirement Levels", BCP 14, RFC 2119, March 1997.
  3776.  
  3777.    [RFC2261] Harrington, D., Presuhn, R., and B. Wijnen, "An
  3778.       Architecture for describing SNMP Management Frameworks", RFC 2261,
  3779.       January 1998.
  3780.  
  3781.    [RFC2262] Case, J., Harrington, D., Presuhn, R., and B. Wijnen,
  3782.       "Message Processing and Dispatching for the Simple Network
  3783.       Management Protocol (SNMP)", RFC 2262, January 1998.
  3784.  
  3785.    [Localized-Key] U. Blumenthal, N. C. Hien, B. Wijnen
  3786.       "Key Derivation for Network Management Applications" IEEE Network
  3787.       Magazine, April/May issue, 1997.
  3788.  
  3789.    [DES-NIST] Data Encryption Standard, National Institute of Standards
  3790.       and Technology.  Federal Information Processing Standard (FIPS)
  3791.       Publication 46-1.  Supersedes FIPS Publication 46, (January, 1977;
  3792.       reaffirmed January, 1988).
  3793.  
  3794.    [DES-ANSI] Data Encryption Algorithm, American National Standards
  3795.       Institute.  ANSI X3.92-1981, (December, 1980).
  3796.  
  3797.    [DESO-NIST] DES Modes of Operation, National Institute of Standards
  3798.       and Technology.  Federal Information Processing Standard (FIPS)
  3799.       Publication 81, (December, 1980).
  3800.  
  3801.    [DESO-ANSI] Data Encryption Algorithm - Modes of Operation, American
  3802.       National Standards Institute.  ANSI X3.106-1983, (May 1983).
  3803.  
  3804.    [DESG-NIST] Guidelines for Implementing and Using the NBS Data
  3805.       Encryption Standard, National Institute of Standards and
  3806.       Technology.  Federal Information Processing Standard (FIPS)
  3807.  
  3808.  
  3809.  
  3810. Blumenthal & Wijnen         Standards Track                    [Page 68]
  3811.  
  3812. RFC 2264                     USM for SNMPv3                 January 1998
  3813.  
  3814.  
  3815.       Publication 74, (April, 1981).
  3816.  
  3817.    [DEST-NIST] Validating the Correctness of Hardware Implementations of
  3818.       the NBS Data Encryption Standard, National Institute of Standards
  3819.       and Technology.  Special Publication 500-20.
  3820.  
  3821.    [DESM-NIST] Maintenance Testing for the Data Encryption Standard,
  3822.       National Institute of Standards and Technology.  Special
  3823.       Publication 500-61, (August, 1980).
  3824.  
  3825.    [SHA-NIST] Secure Hash Algorithm. NIST FIPS 180-1, (April, 1995)
  3826.       http://csrc.nist.gov/fips/fip180-1.txt (ASCII)
  3827.       http://csrc.nist.gov/fips/fip180-1.ps  (Postscript)
  3828.  
  3829. 13.  Editors' Addresses
  3830.  
  3831.    Uri Blumenthal
  3832.    IBM T. J. Watson Research
  3833.    30 Saw Mill River Pkwy,
  3834.    Hawthorne, NY 10532
  3835.    USA
  3836.  
  3837.    EMail:      uri@watson.ibm.com
  3838.    Phone:      +1-914-784-7064
  3839.  
  3840.  
  3841.    Bert Wijnen
  3842.    IBM T. J. Watson Research
  3843.    Schagen 33
  3844.    3461 GL Linschoten
  3845.    Netherlands
  3846.  
  3847.    EMail:      wijnen@vnet.ibm.com
  3848.    Phone:      +31-348-432-794
  3849.  
  3850.  
  3851.  
  3852.  
  3853.  
  3854.  
  3855.  
  3856.  
  3857.  
  3858.  
  3859.  
  3860.  
  3861.  
  3862.  
  3863.  
  3864.  
  3865.  
  3866. Blumenthal & Wijnen         Standards Track                    [Page 69]
  3867.  
  3868. RFC 2264                     USM for SNMPv3                 January 1998
  3869.  
  3870.  
  3871. APPENDIX A - Installation
  3872.  
  3873. A.1.  SNMP engine Installation Parameters
  3874.  
  3875.    During installation, an authoritative SNMP engine SHOULD (in the
  3876.    meaning as defined in [RFC2119]) be configured with several initial
  3877.    parameters.  These include:
  3878.  
  3879.    1) A security posture
  3880.  
  3881.       The choice of security posture determines if initial configuration
  3882.       is implemented and if so how.  One of three possible choices is
  3883.       selected:
  3884.  
  3885.             minimum-secure,
  3886.             semi-secure,
  3887.             very-secure (i.e., no-initial-configuration)
  3888.  
  3889.       In the case of a very-secure posture, there is no initial
  3890.       configuration, and so the following steps are irrelevant.
  3891.  
  3892. 2) one or more secrets
  3893.  
  3894.    These are the authentication/privacy secrets for the first user to be
  3895.    configured.
  3896.  
  3897.    One way to accomplish this is to have the installer enter a
  3898.    "password" for each required secret. The password is then
  3899.    algorithmically converted into the required secret by:
  3900.  
  3901.    - forming a string of length 1,048,576 octets by repeating the
  3902.      value of the password as often as necessary, truncating
  3903.      accordingly, and using the resulting string as the input to the MD5
  3904.      algorithm [MD5].  The resulting digest, termed "digest1", is used
  3905.      in the next step.
  3906.  
  3907.    - a second string is formed by concatenating digest1, the SNMP
  3908.      engine's snmpEngineID value, and digest1.  This string is used as
  3909.      input to the MD5 algorithm [MD5].
  3910.  
  3911.      The resulting digest is the required secret (see Appendix A.2).
  3912.  
  3913.    With these configured parameters, the SNMP engine instantiates the
  3914.    following usmUserEntry in the usmUserTable:
  3915.  
  3916.  
  3917.  
  3918.  
  3919.  
  3920.  
  3921.  
  3922. Blumenthal & Wijnen         Standards Track                    [Page 70]
  3923.  
  3924. RFC 2264                     USM for SNMPv3                 January 1998
  3925.  
  3926.  
  3927.                            no privacy support     privacy support
  3928.                            ------------------     ---------------
  3929.    usmUserEngineID         localEngineID          localEngineID
  3930.    usmUserName             "initial"              "initial"
  3931.    usmUserSecurityName     "initial"              "initial"
  3932.    usmUserCloneFrom        ZeroDotZero            ZeroDotZero
  3933.    usmUserAuthProtocol     usmHMACMD5AuthProtocol usmHMACMD5AuthProtocol
  3934.    usmUserAuthKeyChange    ""                     ""
  3935.    usmUserOwnAuthKeyChange ""                     ""
  3936.    usmUserPrivProtocol     none                   usmDESPrivProtocol
  3937.    usmUserPrivKeyChange    ""                     ""
  3938.    usmUserOwnPrivKeyChange ""                     ""
  3939.    usmUserPublic           ""                     ""
  3940.    usmUserStorageType      anyValidStorageType    anyValidStorageType
  3941.    usmUserStatus           active                 active
  3942.  
  3943. A.2.  Password to Key Algorithm
  3944.  
  3945.    A sample code fragment (section A.2.1) demonstrates the password to
  3946.    key algorithm which can be used when mapping a password to an
  3947.    authentication or privacy key using MD5. The reference source code of
  3948.    MD5 is available in [RFC1321].
  3949.  
  3950.    Another sample code fragment (section A.2.2) demonstrates the
  3951.    password to key algorithm which can be used when mapping a password
  3952.    to an authentication or privacy key using SHA (documented in SHA-
  3953.    NIST).
  3954.  
  3955.    An example of the results of a correct implementation is provided
  3956.    (section A.3) which an implementor can use to check if his
  3957.    implementation produces the same result.
  3958.  
  3959. A.2.1.  Password to Key Sample Code for MD5
  3960.  
  3961. void password_to_key_md5(
  3962.    u_char *password,    /* IN */
  3963.    u_int   passwordlen, /* IN */
  3964.    u_char *engineID,    /* IN  - pointer to snmpEngineID  */
  3965.    u_int   engineLength /* IN  - length of snmpEngineID */
  3966.    u_char *key)         /* OUT - pointer to caller 16-octet buffer */
  3967. {
  3968.    MD5_CTX     MD;
  3969.    u_char     *cp, password_buf[64];
  3970.    u_long      password_index = 0;
  3971.    u_long      count = 0, i;
  3972.  
  3973.    MD5Init (&MD);   /* initialize MD5 */
  3974.  
  3975.  
  3976.  
  3977.  
  3978. Blumenthal & Wijnen         Standards Track                    [Page 71]
  3979.  
  3980. RFC 2264                     USM for SNMPv3                 January 1998
  3981.  
  3982.  
  3983.    /**********************************************/
  3984.    /* Use while loop until we've done 1 Megabyte */
  3985.    /**********************************************/
  3986.    while (count < 1048576) {
  3987.       cp = password_buf;
  3988.       for (i = 0; i < 64; i++) {
  3989.           /*************************************************/
  3990.           /* Take the next octet of the password, wrapping */
  3991.           /* to the beginning of the password as necessary.*/
  3992.           /*************************************************/
  3993.           *cp++ = password[password_index++ % passwordlen];
  3994.       }
  3995.       MD5Update (&MD, password_buf, 64);
  3996.       count += 64;
  3997.    }
  3998.    MD5Final (key, &MD);          /* tell MD5 we're done */
  3999.  
  4000.    /*****************************************************/
  4001.    /* Now localize the key with the engineID and pass   */
  4002.    /* through MD5 to produce final key                  */
  4003.    /* May want to ensure that engineLength <= 32,       */
  4004.    /* otherwise need to use a buffer larger than 64     */
  4005.    /*****************************************************/
  4006.    memcpy(password_buf, key, 16);
  4007.    memcpy(password_buf+16, engineID, engineLength);
  4008.    memcpy(password_buf+engineLength, key, 16);
  4009.  
  4010.    MD5Init(&MD);
  4011.    MD5Update(&MD, password_buf, 32+engineLength);
  4012.    MD5Final(key, &MD);
  4013.  
  4014.    return;
  4015. }
  4016.  
  4017. A.2.2.  Password to Key Sample Code for SHA
  4018.  
  4019. void password_to_key_sha(
  4020.    u_char *password,    /* IN */
  4021.    u_int   passwordlen, /* IN */
  4022.    u_char *engineID,    /* IN  - pointer to snmpEngineID  */
  4023.    u_int   engineLength /* IN  - length of snmpEngineID */
  4024.    u_char *key)         /* OUT - pointer to caller 20-octet buffer */
  4025. {
  4026.    SHA_CTX     SH;
  4027.    u_char     *cp, password_buf[72];
  4028.    u_long      password_index = 0;
  4029.    u_long      count = 0, i;
  4030.  
  4031.  
  4032.  
  4033.  
  4034. Blumenthal & Wijnen         Standards Track                    [Page 72]
  4035.  
  4036. RFC 2264                     USM for SNMPv3                 January 1998
  4037.  
  4038.  
  4039.    SHAInit (&SH);   /* initialize SHA */
  4040.  
  4041.    /**********************************************/
  4042.    /* Use while loop until we've done 1 Megabyte */
  4043.    /**********************************************/
  4044.    while (count < 1048576) {
  4045.       cp = password_buf;
  4046.       for (i = 0; i < 64; i++) {
  4047.           /*************************************************/
  4048.           /* Take the next octet of the password, wrapping */
  4049.           /* to the beginning of the password as necessary.*/
  4050.           /*************************************************/
  4051.           *cp++ = password[password_index++ % passwordlen];
  4052.       }
  4053.       SHAUpdate (&SH, password_buf, 64);
  4054.       count += 64;
  4055.    }
  4056.    SHAFinal (key, &SH);          /* tell SHA we're done */
  4057.  
  4058.    /*****************************************************/
  4059.    /* Now localize the key with the engineID and pass   */
  4060.    /* through SHA to produce final key                  */
  4061.    /* May want to ensure that engineLength <= 32,       */
  4062.    /* otherwise need to use a buffer larger than 72     */
  4063.    /*****************************************************/
  4064.    memcpy(password_buf, key, 20);
  4065.    memcpy(password_buf+20, engineID, engineLength);
  4066.    memcpy(password_buf+engineLength, key, 20);
  4067.  
  4068.    SHAInit(&SH);
  4069.    SHAUpdate(&SH, password_buf, 40+engineLength);
  4070.    SHAFinal(key, &SH);
  4071.  
  4072.    return;
  4073. }
  4074.  
  4075. A.3.  Password to Key Sample Results
  4076.  
  4077. A.3.1.  Password to Key Sample Results using MD5
  4078.  
  4079.    The following shows a sample output of the password to key algorithm
  4080.    for a 16-octet key using MD5.
  4081.  
  4082.    With a password of "maplesyrup" the output of the password to key
  4083.    algorithm before the key is localized with the SNMP engine's
  4084.    snmpEngineID is:
  4085.  
  4086.       '9f af 32 83 88 4e 92 83 4e bc 98 47 d8 ed d9 63'H
  4087.  
  4088.  
  4089.  
  4090. Blumenthal & Wijnen         Standards Track                    [Page 73]
  4091.  
  4092. RFC 2264                     USM for SNMPv3                 January 1998
  4093.  
  4094.  
  4095.    After the intermediate key (shown above) is localized with the
  4096.    snmpEngineID value of:
  4097.  
  4098.       '00 00 00 00 00 00 00 00 00 00 00 02'H
  4099.  
  4100.    the final output of the password to key algorithm is:
  4101.  
  4102.       '52 6f 5e ed 9f cc e2 6f 89 64 c2 93 07 87 d8 2b'H
  4103.  
  4104. A.3.2.  Password to Key Sample Results using SHA
  4105.  
  4106.       The following shows a sample output of the password to key
  4107.       algorithm for a 20-octet key using SHA.
  4108.  
  4109.       With a password of "maplesyrup" the output of the password to key
  4110.       algorithm before the key is localized with the SNMP engine's
  4111.       snmpEngineID is:
  4112.  
  4113.       'f1 be a9 ae 66 7f 4f b6 34 1e 51 af 06 80 7e 91 e4 3b 01 ac'H
  4114.  
  4115.    After the intermediate key (shown above) is localized with the
  4116.    snmpEngineID value of:
  4117.  
  4118.       '00 00 00 00 00 00 00 00 00 00 00 02'H
  4119.  
  4120.    the final output of the password to key algorithm is:
  4121.  
  4122.       '8a a3 d9 9e 3e 30 56 f2 bf e3 a9 ee f3 45 d5 39 54 91 12 be'H
  4123.  
  4124. A.4.  Sample encoding of msgSecurityParameters
  4125.  
  4126.    The msgSecurityParameters in an SNMP message are represented as an
  4127.    OCTET STRING. This OCTET STRING should be considered opaque outside a
  4128.    specific Security Model.
  4129.  
  4130.    The User-based Security Model defines the contents of the OCTET
  4131.    STRING as a SEQUENCE (see section 2.4).
  4132.  
  4133.    Given these two properties, the following is an example of the
  4134.    msgSecurityParameters for the User-based Security Model, encoded as
  4135.    an OCTET STRING:
  4136.  
  4137.      04 <length>
  4138.      30 <length>
  4139.      04 <length> <msgAuthoritativeEngineID>
  4140.      02 <length> <msgAuthoritativeEngineBoots>
  4141.      02 <length> <msgAuthoritativeEngineTime>
  4142.      04 <length> <msgUserName>
  4143.  
  4144.  
  4145.  
  4146. Blumenthal & Wijnen         Standards Track                    [Page 74]
  4147.  
  4148. RFC 2264                     USM for SNMPv3                 January 1998
  4149.  
  4150.  
  4151.      04 0c       <HMAC-MD5-96-digest>
  4152.      04 08       <salt>
  4153.  
  4154.    Here is the example once more, but now with real values (except for
  4155.    the digest in msgAuthenticationParameters and the salt in
  4156.    msgPrivacyParameters, which depend on variable data that we have not
  4157.    defined here):
  4158.  
  4159.      Hex Data                         Description
  4160.      --------------  -----------------------------------------------
  4161.      04 39           OCTET STRING,                  length 57
  4162.      30 37           SEQUENCE,                      length 55
  4163.      04 0c 80000002  msgAuthoritativeEngineID:      IBM
  4164.            01                                       IPv4 address
  4165.            09840301                                 9.132.3.1
  4166.      02 01 01        msgAuthoritativeEngineBoots:   1
  4167.      02 02 0101      msgAuthoritativeEngineTime:    257
  4168.      04 04 62657274  msgUserName:                   bert
  4169.      04 0c 01234567  msgAuthenticationParameters:   sample value
  4170.            89abcdef
  4171.            fedcba98
  4172.      04 08 01234567  msgPrivacyParameters:          sample value
  4173.            89abcdef
  4174.  
  4175.  
  4176.  
  4177.  
  4178.  
  4179.  
  4180.  
  4181.  
  4182.  
  4183.  
  4184.  
  4185.  
  4186.  
  4187.  
  4188.  
  4189.  
  4190.  
  4191.  
  4192.  
  4193.  
  4194.  
  4195.  
  4196.  
  4197.  
  4198.  
  4199.  
  4200.  
  4201.  
  4202. Blumenthal & Wijnen         Standards Track                    [Page 75]
  4203.  
  4204. RFC 2264                     USM for SNMPv3                 January 1998
  4205.  
  4206.  
  4207. B.  Full Copyright Statement
  4208.  
  4209.    Copyright (C) The Internet Society (1997).  All Rights Reserved.
  4210.  
  4211.    This document and translations of it may be copied and furnished to
  4212.    others, and derivative works that comment on or otherwise explain it
  4213.    or assist in its implementation may be prepared, copied, published
  4214.    and distributed, in whole or in part, without restriction of any
  4215.    kind, provided that the above copyright notice and this paragraph are
  4216.    included on all such copies and derivative works.  However, this
  4217.    document itself may not be modified in any way, such as by removing
  4218.    the copyright notice or references to the Internet Society or other
  4219.    Internet organizations, except as needed for the purpose of
  4220.    developing Internet standards in which case the procedures for
  4221.    copyrights defined in the Internet Standards process must be
  4222.    followed, or as required to translate it into languages other than
  4223.    English.
  4224.  
  4225.    The limited permissions granted above are perpetual and will not be
  4226.    revoked by the Internet Society or its successors or assigns.
  4227.  
  4228.    This document and the information contained herein is provided on an
  4229.    "AS IS" basis and THE INTERNET SOCIETY AND THE INTERNET ENGINEERING
  4230.    TASK FORCE DISCLAIMS ALL WARRANTIES, EXPRESS OR IMPLIED, INCLUDING
  4231.    BUT NOT LIMITED TO ANY WARRANTY THAT THE USE OF THE INFORMATION
  4232.    HEREIN WILL NOT INFRINGE ANY RIGHTS OR ANY IMPLIED WARRANTIES OF
  4233.    MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE.
  4234.  
  4235.  
  4236.  
  4237.  
  4238.  
  4239.  
  4240.  
  4241.  
  4242.  
  4243.  
  4244.  
  4245.  
  4246.  
  4247.  
  4248.  
  4249.  
  4250.  
  4251.  
  4252.  
  4253.  
  4254.  
  4255.  
  4256.  
  4257.  
  4258. Blumenthal & Wijnen         Standards Track                    [Page 76]
  4259.  
  4260.