Network Working Group                            U. Blumenthal 
            Internet Draft                             Lucent Technologies 
            Document: draft-blumenthal-aes-usm-01.doc            July 2001 
            Category: Experimental                     
             
             
                    AES (Rijndael) Encryption Protocol with SNMPv3 USM 
             
             
            Status of this Memo 
             
               This  document  is  an  Internet-Draft  and  is  in  full 
               conformance with all provisions of Section 10 of RFC2026 
               [1].  
                
               Internet-Drafts  are  working  documents  of  the  Internet 
               Engineering Task Force (IETF), its areas, and its working 
               groups. Note that other groups may also distribute working 
               documents as Internet-Drafts. Internet-Drafts are draft 
               documents valid for a maximum of six months and may be 
               updated, replaced, or obsoleted by other documents at any 
               time. It is inappropriate to use Internet- Drafts as 
               reference material or to cite them other than as "work in 
               progress."  
                
               The list of current Internet-Drafts can be accessed at 
               http://www.ietf.org/ietf/1id-abstracts.txt  
                
               The  list  of  Internet-Draft  Shadow  Directories  can  be 
               accessed at http://www.ietf.org/shadow.html. 
                
                
               For potential updates to the above required-text see: 
               http://www.ietf.org/ietf/1id-guidelines.txt 
                
                
                
            1. Abstract 
                
               This document describes the use of Rijndael encryption 
               protocol with  User-based Security Model (USM) for SNMP 
               version 3. This protocol provides data confidentiality. 
               This document augments and should be used with RFC 2574 
               [1]. 
                
                
            2. Conventions used in this document 
                
               The key words "MUST", "MUST NOT", "REQUIRED", "SHALL", 
               "SHALL  NOT",  "SHOULD",  "SHOULD  NOT",  "RECOMMENDED",  
               "MAY",  and  "OPTIONAL"  in  this  document  are  to  be 
               interpreted as described in RFC-2119 [2]. 
                
                
               K    - secret key for the AES encryption engine. 
               IV   - 32-bit Initialization Vector for the AES engine 
              
            Blumenthal              Experimental                [Page 1] 


             
            Internet Draft         AES in USM SNMPv3            July 2001 
             
               i    - 32-bit counter (initialized to one). 
               E(K,P) - encrypting P in ECB mode under key K. 
               P[i] - i-th block of the plaintext(all but last: 128-bit). 
               C[i] - i-th block of the ciphertext(size - same as above). 
               C[i][j] û j-th 4-byte word of O[i]  (1 <= j <= 4). 
               S[i]    - the encryptor input value for i-th step. 
               S[i][j] û j-th 4-byte word of S[i]  (1 <= j <= 4). 
               O[i]    û encryptor output value  O[i]=E(K,S[i]). 
               A^b     - A raised in power b. 
               XOR     - bitwise operation eXclusive OR. 
               A * B   - A multiplied by B. 
                
                
               When an integer value (i, snmpEngineTime, snmpEngineBoots) 
               is  placed  in  the  octet  string  such  as  S[i],  it  is 
               converted to Network Byte Order if necessary (Big-Endian), 
               and then copied byte by byte from left to right. 
                
                
                
            3. Overview 
                
               At the time of writing of this document, Rijndael [4] has 
               been  declared  the  proposed  AES  (Advanced  Encryption 
               Standard) [5] by NIST. This, together with the fact that 
               practical  attacks  on  DES  became  feasible,  makes  it 
               necessary  to  define  new  privacy  protocols  for  USM. 
               Rijndael is the natural candidate to base them on. 
                
                    The protocol is very similar to CBC-DES Symmetric 
               Encryption  Protocol  described  in  RFC  2574  [3].  The 
               underlying cipher and protocol differ from RFC 2574 as 
               follows: 
                     
                    .Rijndael uses longer keys (AES permits 128-, 192- and 
                      256-bit long keys, with USM we recommend 128-bit 
                      key for most applications); 
                    .Rijndael block size is 128 bits (instead of 64 bits 
                      in DES), which may affect the resulting message 
                      size, depending on what encryption mode is used; 
                    .Recommended encryption mode is GCFB, for the purpose 
                      of  maximizing  performance  and  preserving  the 
                      message size; 
                    .Explicit Initialization Vector (IV) is truncated to 
                      32 bits, and the rest of the IV is filled according 
                      to the algorithm described below; 
                    .Encryption and decryption processes are the same, 
                      thus  the  crypto  engine  must  implement  only 
                      encryption  and  does  not  have  to  implement 
                      decryption procedure. 
                
             
            3.1. Generalized Counter Feedback Mode 
                

              
            Blumenthal               Experimental               [Page 2] 
             


             
            Internet Draft         AES in USM SNMPv3            July 2001 
             
               GCFB is a stream cipher mode. It combines the advantages 
               of CTR-mode (Counter) and of CFB (Cipher Feedback) mode. 
               It is fast, does not increase the size of the ciphertext, 
               has property of error propagation (due to the feedback). 
               The cipher engine is used only in encryption mode (AES 
               decryption  feature  is  not  needed).  It  produces  a 
               pseudorandom stream that is XOR-ed with the plaintext. To 
               create pseudorandom stream, a 128-bit input string is 
               encrypted.  Like  the  CTR-mode,  part  of  that  string 
               comprises of a counter that increments by one with each 
               encryption iteration. Like CFB-mode, part of the resulting 
               ciphertext is fed back to the 128-bit string, affecting 
               the next 128-bit of pseudorandom stream. 
                
                
            4. AES (Rijndael) Symmetric Encryption Protocol 
                
               Rijndael is a modern 128-bit block cipher developed by 
               Joan Deamen and Vincent Rijmen [4], declared by NIST a 
               proposed AES (successor to DES). Its description, modes of 
               operation,   validation   test   suite   and   reference 
               implementation code are available on the AES NIST Web site 
               [5]. 
                
               Rijndael takes 128-, 192- and 256-bit long keys. For USM 
               it is believed that 128-bit keys are sufficient. However 
               neither USM [3] nor the Rijndael protocol as specified 
               here, mandate any particular key length - thus all the 
               three key length options are acceptable. 
                
                
               Rijndael  encryption  algorithm  is  used  to  encrypt  the 
               designated portion of an SNMP message, which along with 
               Rijndael Initialization Vector is included as a part of 
               the message sent to the recipient. 
                
                
            4.1. Rijndael Key 
                
               Rijndael key is an octet string of 16, 24, or 32 bytes. 
               The recommended length is 16 bytes, which is deemed enough 
               for most applications. 
                
               The key is (implicitly) stored in the USM User table and 
               can be manipulated using SNMPv3 protocol via access to USM 
               User Table [3]. 
                
               The whole length of the octet string representing the 
               secret  privacy  key  is  used  as  a  Rijndael  key  (see 
               usmUserPrivKeyChange and usmUserOwnPrivKeyChange in [3]). 
               KeyChange Textual Convention governs the process, for the 
               keys of 128-, 192- and 256-bit length. It is strongly 
               recommended that only SHA-1 is used, and not MD5 (SHA-256 
               and SHA-512 are good choices to replace SHA-1). 
                
              
            Blumenthal               Experimental               [Page 3] 
             


             
            Internet Draft         AES in USM SNMPv3            July 2001 
             
               If a password or other variable-length user input needs to 
               be converted to a Rijndael key, follow the algorithm given 
               in RFC 2574.  
                
               Throughout this document it is assumed that the Rijndael 
               key is localized, as described in RFC 2574.  
                
                
            4.2. Rijndael Initialization Vector 
                
               It is up to the entity in question how to obtain/compute 
               the 32-bit IV. On Unix operating systems one can use 
               reasonably   secure   random   number   sources   such   as 
               /dev/random. 
                 
               IV should satisfy the following requirements: 
                    .Unique (non-repeating from one packet to another); 
                    .Varying "rapidly" (considerable amount of bits change 
                      from one IV to another). 
                     
               It  is  preferable  but  not  required,  that  IV  is 
               unpredictable. 
                
                
                
            4.3. Message encryption 
                
               The data to be encrypted is treated as sequence of octets. 
                
               The data is encrypted in Generalized Counter Feedback 
               (GCFB) mode. 
                
               The plaintext is divided into a sequence of n 128-bit 
               blocks P[1], P[2], P[3],  à , P[i], à , P[n]. Possibly the 
               last block P[n] is shorter than 128 bits. 
                
               Let i be 32-bit counter, initialized to 1. 
                
               After 32-bit IV is selected (se 4.2), 128-bit S[i] for i=1 
               is constructed in the following way: 
                 1. First 32 bits are filled with 32-bit counter i. 
                 2. Second 32 bits are filled with 32-bit IV. 
                 3. Third  32 bits are filled with snmpEngineBoots. 
                 4. Fourth 32 bits are filled with snmpEngineTime. 
                
               SnmpEngineBoots and snmpEngineTime must match those that 
               will be inserted in the SNMPv3 USM Message header. 
                
               for (i=1; i <= n; i++) do: 
                    1.S[i][1] = i; 
                    2.Obtain   O   by   encrypting   S   using   key   K:            
                      O[i] = E(K,S[i]); 
                    3.Ciphertext C is XOR of plaintext P and O (result of 
                      encryption at step 1): C[i] = P[i] XOR O[i]; 

              
            Blumenthal               Experimental               [Page 4] 
             


             
            Internet Draft         AES in USM SNMPv3            July 2001 
             
                    4.Copy the last 32 bits of C[i] to the second word 
                      (second 32 bits of S: S[i+1][2] = C[i][4]; 
                    5.Output C[i] as encryption of P[i]. 
                
               Algorithmically it means:  
                
                    for as long as there are input plaintext blocks 
                            1.Fill the first 32 bits of S[i] with the 
                              value i; 
                            2.Rijndael-encrypt  the  value  of  S[i]  with 
                              secret key, obtaining O[i]; 
                            3.Take the plaintext block P[i] and XOR it 
                              with O[i], obtaining C[i]; 
                            4.Take the rightmost 32 bits of C[i] and 
                              replace with them second 32-bit word) of 
                              S[i], obtaining S[i+1] (counter will also 
                              be updated: here it is shown at step 1); 
                            5.Output the result of the step 3, as the 
                              next ciphertext block C[i]. 
                             
               If the last block P[n] has length L that is shorter than 
               128 bits, only the leftmost L bits of O[n] are used at 
               step 3 to obtain C[n]. 
                
                
                
            4.4. Message decryption 
                
               The data to be decrypted is treated as sequence of octets. 
                
               The data is decrypted in Generalized Counter Feedback 
               (GCFB) mode. 
                
               The ciphertext is divided into a sequence of n 128-bit 
               blocks C[1], C[2], C[3], à , C[i], à , C[n]. Possibly the 
               last block C[n] is shorter than 128 bits. 
                
               Form S[i] (i=1) the following way: 
                  1. Copy the 32-bit value of IV retrieved from the 
                     privParameters to second 32-bit word of S[1]. 
                  2. Copy  the  32-bit  msgSnmpEngineBoots  value  to  the 
                     third 32-bit word of S[1]. 
                  3. Copy  the  32-bit  msgSnmpEngineTime  value  to  the 
                     fourth 32-bit word of S[1]. 
                
               for (i=1; i <= n; i++) do: 
                    1.Complete S[i]:                  S[i][1] = i; 
                    2.Encrypt S[i], obtaining O[i]:   O[i] = E(K,S[i]); 
                    3.Obtain i-th block of plaintext: P[i] = C[i] XOR 
                      O[i]; 
                    4.Update S[i] to S[i+1]:  S[i+1][2] = C[i][4]; 
                    5.Output P[i] as i-th block of plaintext. 
                
               Algorithmically it means:  
                
              
            Blumenthal               Experimental               [Page 5] 
             


             
            Internet Draft         AES in USM SNMPv3            July 2001 
             
                    for as long as there are input ciphertext blocks 
                      1. Fill the first 32 bits of S[i] with i (value of 
                         the counter); 
                      2. Rijndael-encrypt the value S[i] using secret key 
                         K, obtaining O[i]; 
                      3. XOR O[i] with C[i], obtaining plaintext block 
                         P[i]; 
                      4. Take rightmost 32 bits of C[i] and replace with 
                         them the current value of second word of S[i], 
                         obtaining S[i+1]; 
                      5. Output P[i] as i-th block of plaintext. 
                
                
               If the last block C[n] has length L that is shorter than 
               128 bits, only the leftmost L bits of O[n] are used at 
               step 3 to obtain P[n]. 
                
                
                
             
            5. MIB Definitions 
                
                
               usmAESPrivProtocol   OBJECT-IDENTITY 
                    STATUS          current 
                    DESCRIPTION     "The  Rijndael  Symmetric  Encryption 
                    Protocol" 
                    REFERENCE       "Advanced Encryption Standard - NIST. 
                                     http://www.nist.gov/aes" 
                    ::= { snmpPrivProtocols 4 } 
                
                
            6. Rijndael Encryption Services 
             
               Here  we  describe  the  Rijndael-based  privacy  services, 
               which are called upon by User-based Security Model (USM) 
               to encrypt and decrypt SNMPv3 message payload.  
                
               These are the same as described in RFC 2574.  
                
               Messages   using   this   privacy   protocol   carry   a 
               msgPrivacyParameters    field    as    part    of    the 
               msgSecurityParameters.    For    this    protocol,    the 
               msgPrivacyParameters field is the serialized OCTET STRING 
               representing the IV. 
             
                
            6.1. Services for encrypting outgoing data 
                
               This Rijndael privacy protocol assumes that the caller 
               does the selection of the privKey and that the caller 
               passes the secret key to be used. 
                
               To encrypt the payload (scopedPDU - see [6]) the User-
               based Security Model (USM) will pass the payload and the 
              
            Blumenthal               Experimental               [Page 6] 
             


             
            Internet Draft         AES in USM SNMPv3            July 2001 
             
               encryption key to the privacy service which implements 
               Rijndael protocol, receiving back the encryptedPDU (see 
               [6]) and the privParameters containing IV (see [3]). 
                
               Upon    completion,    the    privacy    service    returns 
               statusInformation  and,  if  the  encryption  process  was 
               successful, the encryptedPDU and the  msgPrivacyParameters 
               encoded as an OCTET STRING.  
                
               The abstract service primitive is: 
                
                
               statusInformation = 
                  encryptData( 
                      IN  encryptKey     -- secret key for encryption 
                      IN  dataToEncrypt -- data to encrypt (scopedPDU) 
                      OUT encryptedData -- encrypted data (encryptedPDU) 
                      OUT privParamets  -- filled in by service provider 
                  ) 
                
                
                
            6.2. Services for decrypting incoming data 
                
               This Rijndael privacy protocol assumes that the caller 
               does the selection of the privKey and that the caller 
               passes the secret key to be used. 
                
               To decrypt the payload (encryptedPDU - see[4]) the USM 
               will pass the encryptedPDU, secret key and privParameters  
               to  the  privacy  service,  receiving  back  the  decrypted 
               plaintext scopedPDU. 
                
               statusInformation  indicates  whether  the  decryption  was 
               successful. 
                
               Upon    completion    the    privacy    module    returns 
               statusInformation and, if   the decryption process was 
               successful, the scopedPDU in plain text. 
                
               The abstract service primitive is: 
             
               statusInformation = 
                  decryptData( 
                      IN  decryptKey      -- secret key for decrypting 
                      IN  privParameters  -- as received on the wire 
                      IN  encryptedData  -- encrypted data (encryptedPDU) 
                      OUT decryptedData  -- decrypted data (scopedPDU) 
                  ) 
             
                
                
                
                
                

              
            Blumenthal               Experimental               [Page 7] 
             


             
            Internet Draft         AES in USM SNMPv3            July 2001 
             
                
            7. Elements of the procedure 
                
               This section describes the procedure followed by an SNMP 
               engine    whenever it must encrypt part of an outgoing 
               message using the   usmAESPrivProtocol. 
                
             
             
             7.1. Processing an Outgoing Message 
                
                 1.IV is computed. 
                 2.privParameters  field  is  set  to  the  serialization 
                    according to the rules in [RFC1906] of the OCTET 
                    STRING representing the 4-octet-long IV. 
                 3.The scopedPDU is encrypted (as described above in 4.3) 
                    and the encrypted data is serialized according to the 
                    rules in [RFC1906] as an OCTET STRING. 
                 4.The serialized OCTET STRING representing the encrypted       
                    scopedPDU  together  with  the  privParameters  and 
                    statusInformation indicating success is returned to 
                    the calling module. 
                
              7.2. Processing an Incoming Message 
                
                    1.If the privParameters field is not a 4-octet OCTET 
                      STRING, then an error indication (decryptionError) 
                      is returned to the calling module. 
                    2.IV is extracted from privParameters. 
                    3.The encryptedPDU is decrypted, as described above 
                      in 4.4. 
                    4.The decrypted scopedPDU and the statusInformation 
                      are returned to the caller. 
                
                
                
            8. Security Considerations 
             
               The strength of this protocol depends on the cryptographic 
               strength  of  SHA-1  hash-function  (properties  of  the 
               generated key) and of Rijndael block cipher (security of 
               the encryption). It will be better to use SHA-256 or SHA-
               512 for AES key generation, but we want to give more time 
               to their studying by the world cryptographic community. 
                
               An adversary can predictably change the plaintext bits by 
               modifying   the   corresponding   ciphertext   bits   when 
               encryption in GCFB mode is used. Therefore it is vital to 
               adhere to USM requirement given in RFC 2574 and always use 
               authentication with encryption. 
                
                
                
                
                
              
            Blumenthal               Experimental               [Page 8] 
             


             
            Internet Draft         AES in USM SNMPv3            July 2001 
             
                
                
            9. References 
                                 
                
                
                
               1.S. Bradner ôThe Internet Standard Process û Revision 3ö, 
                RFC 2026. Oct 1996. 
               2.S. Bradner ôKey words to use in the RFCsö, RFC 2119. Mar 
                1997. 
               3.U.  Blumenthal,  B.  Wijnen  ôUser-based  Security  Model 
                (USM) for version 3 of the Simple Network Management 
                Protocol (SNMPv3)ö, RFC 2574, April 1999. 
               4.J.  Daemen,  V.  Rijmen  "The  Block  Cipher  Rijndael" 
                http://www.esat.kuleuven.ac.be/~rijmen/rijndael/ 
               5.Rijndael:    NIST's    Selection    for    the    AES 
                http://csrc.nist.gov/encryption/aes/rijndael/ 
               6.D. Harrington, R. Presuhn, B. Wijnen ôAn Architecture 
                for Describing SNMP Management Frameworkö, RFC 2571. 
                April 1999. 
                
             
                
                
            10. Acknowledgments 
                
               Help of the members of Wireless Security Group at Lucent 
               Technologies, especially of Dr. Ganesh Sundaram, SNMPv3 WG 
               and Security Area Directorate is gratefully acknowledged. 
               Special thanks go to Wes Hardaker and Randy Presuhn for 
               detailed review and helpful comments. 
                
             
            11. Author's Addresses 
                
               Uri Blumenthal 
               Lucent Technologies / Bell Labs 
               14D-318 
               67 Whippany Rd 
               Whippany, NY  07981 
               USA 
               Phone: +1.973.386.2163 
               Email: uri@lucent.com 
                
                









              
            Blumenthal               Experimental               [Page 9] 
             




             
            Internet Draft         AES in USM SNMPv3            July 2001 
             
                  
            12.Full Copyright Statement 
             
               "Copyright (C) The Internet Society (date). All Rights 
               Reserved. This document and translations of it may be 
               copied and furnished to others, and derivative works that 
               comment on or otherwise explain it or assist in its 
               implementation  may  be  prepared,  copied,  published  and 
               distributed, in whole or in part, without restriction of 
               any kind, provided that the above copyright notice and 
               this  paragraph  are  included  on  all  such  copies  and 
               derivative works. However, this document itself may not be 
               modified in any way, such as by removing the copyright 
               notice or references to the Internet Society or other 
               Internet organizations, except as needed for the purpose 
               of  developing  Internet  standards  in  which  case  the 
               procedures  for  copyrights  defined  in  the  Internet 
               Standards process must be followed, or as required to 
               translate it into languages other than English.  The 
               limited permissions granted above are perpetual and will 
               not be revoked by the Internet Society or its successors 
               or assigns.  This document and the information contained 
               herein is provided on an "AS IS" basis and THE INTERNET 
               SOCIETY AND THE INTERNET ENGINEERING TASK FORCE DISCLAIMS 
               ALL WARRANTIES, EXPRESS OR IMPLIED, INCLUDING BUT NOT 
               LIMITED TO ANY WARRANTY THAT THE USE OF THE INFORMATION 
               HEREIN  WILL  NOT  INFRINGE  ANY  RIGHTS  OR  ANY  IMPLIED 
               WARRANTIES OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR 
               PURPOSE. 
                
                























              
            Blumenthal             Experimental                 [Page 10]