<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE rfc SYSTEM "rfc2629.dtd">
<?rfc toc="yes"?>
<?rfc tocompact="yes"?>
<?rfc tocdepth="3"?>
<?rfc tocindent="yes"?>
<?rfc symrefs="yes"?>
<?rfc sortrefs="yes"?>
<?rfc comments="yes"?>
<?rfc inline="yes"?>
<?rfc compact="yes"?>
<?rfc subcompact="no"?>

<rfc ipr="pre5378Trust200902" 
	 category="std" 
	 docName="draft-herberg-manet-packetbb-sec-02">

  <front>
    <title abbrev="MANET Cryptographical Signature TLV">MANET Cryptographical Signature TLV Definition</title>

    <author fullname="Ulrich Herberg" initials="U" surname="Herberg">
      <organization>LIX, Ecole Polytechnique</organization>
      <address>
        <postal>
          <street></street>
          <city>91128 Palaiseau Cedex</city>
          <region></region>
          <country>France</country>
        </postal>
        <phone>+33-1-6933-4126</phone>
        <email>ulrich@herberg.name</email>
        <uri>http://www.herberg.name/</uri>
      </address>
    </author>

    <author fullname="Thomas Heide Clausen" initials="T" surname="Clausen">
      <organization>LIX, Ecole Polytechnique</organization>
      <address>
         <postal>
          <street></street>
          <city>91128 Palaiseau Cedex</city>
          <region></region>
          <country>France</country>
        </postal>
        <phone>+33 6 6058 9349</phone>
        <email>T.Clausen@computer.org</email>
        <uri>http://www.thomasclausen.org/</uri>
      </address>
    </author>

    <date/>

    <workgroup>Mobile Ad hoc Networking (MANET)</workgroup>
    <keyword>MANET</keyword>

    <abstract>
      <t>
      	This document describes a general and flexible TLV (type-length-value structure) for representing cryptographic signatures as well as timestamps, using the generalized MANET packet/message format <xref target="RFC5444"/>. It defines two Message TLVs and two Packet TLVs, for affixing a cryptographic signature and a timestamp to a packet and message, respectively.
      </t>
    </abstract>

  </front>

  <middle>
    <section title="Introduction">
      <t>
        This document:
        
        <list style="symbols">
        	<t>
        		specifies two TLVs for carrying cryptographic signatures and timestamps in packets and messages as defined by <xref target="RFC5444"/>,
        	</t>
        	<t>
        		requests IANA allocations for these Packet and Message TLVs from
        		the 0-127 Message TLV range and the 0-223 Packet TLV range from <xref target="RFC5444"/>,
        	</t>
        	<t>
        		describes how cryptographic signatures are calculated, taking into account the mutable message header fields (&lt;msg-hop-limit&gt; and &lt;msg-hop-count&gt;) for messages where these fields are present,
        	</t>
        	<t>
        		requests creation of two IANA registries for recording code points for hash function and signature calculation, respectively.
        	</t>
        </list>
        This document does not stipulate how to sign, validate, or encrypt messages.  A specification of a routing protocol or routing protocol extension, using the security representation of this document, MUST specify appropriate interpretation of the TLVs.  This document does specifically not suggest specific cryptographic algorithms or hash functions, but rather establishes IANA registries for such.
      </t>
    </section>

    <section title="Terminology" anchor="terminology">
      <t>
      	The key words "MUST", "MUST NOT", "REQUIRED", "SHALL", "SHALL NOT",
        "SHOULD", "SHOULD NOT", "RECOMMENDED", "NOT RECOMMENDED", "MAY", and
        "OPTIONAL" in this document are to be interpreted as described in 
        <xref target="RFC2119"/>.
      </t>

      <t>This document uses the terminology and notation defined in  <xref target="RFC5444"/>. Additionally, it defines the following terminology:
        <list style="symbols">
          <t>Hash-Function
        	  <list style="hanging">
          		<t>A hash function is an algorithm that takes a message of any length as input and produces a fixed-length string as output. Hash functions are used in cryptography for authentication and message integrity.</t>
	          </list>      
          </t>
          <t>Signature:
    	      <list style="hanging">
        	  	<t>An electronic signature authenticates the signer (who often is the originator) of a message. In addition, it can be verified whether the message has been changed after it has been signed. In many cases, a signature is calculated by encrypting a hash of a message, whis is the basic assumption of this document.</t>
	          </list>
          </t>    
          <t>Timestamp
          	<list style="hanging">
        	  	<t>The timestamp indicates the time when the timestamp has been created. If a timestamp is added to a message before signing the message, this information can be useful to determine the "freshness" of the signed message. "Old" messages can indicate replayed messages.</t>
        	</list>
          </t>
        </list>

      </t>
    </section>

    <section title="Applicability Statement" anchor="applStatement">
		<t>
      		The packet and message format defined in <xref target="RFC5444"/> accords MANET routing protocols using this format the ability to carry additional information in control messages, through inclusion of TLVs. Information so included in a control message MAY be used by the routing protocol, or an extension of the routing protocol, according to its specification.
		</t>
		<t>
			This document specifies how to include a cryptographic signature for a packet or message by way of TLVs, as specified in [RFC5444].  This document also specifies how to treat "mutable" fields (&lt;msg-hop- count&gt; and &lt;msg-hop-limit&gt;) in the message header when calculating the signature, such that the resulting signature can be correctly verified by any recipient, and how to include this signature.  A MANET routing protocol, or an extension of a MANET routing protocol, MAY use such included cryptographic signatures for, for example, rejecting messages where signature verification fails.
			
		</t>
		<t>
			Basic MANET routing protocol specifications are often "oblivious to security", however have a clause allowing a control message to be rejected as "badly formed" prior to it being processed or forwarded. Protocols such as <xref target="NHDP"/> recognize external reasons (such as failure to verify a signature) as being reasons for rejecting a message as "badly formed" and therefore "invalid for processing". This architecture is a result of the observation that with respect to security in MANETs, "one size rarely fits all" and that MANET routing protocol deployment domains have varying security requirements ranging from "unbreakable" to "virtually none". The virtue of this approach is that MANET routing protocol specifications (and implementations) can remain "generic", with extensions providing proper deployment-domain specific security mechanisms.
		</t>
		<t>
			The MANET routing protocol "security architecture", in which this specification situates itself, can therefore be summarized as follows:
			
			<list style="symbols">
				<t> 
					Security-oblivious MANET routing protocol specification, with a clause allowing an extension to reject a message (prior to processing/forwarding) as "badly formed".
				</t>
				<t>
					MANET routing protocol security extensions, rejecting messages as "badly formed", as appropriate for a given deployment-domain.
				</t>
				<t>
					Code-points and an exchange format for information necessary for specification of such security extensions.
				</t>
			</list>
		</t>
		<t>
			This document addresses the last of these issues, by specifying a common exchange format for cryptographic signatures. This document also makes reservations from within the Message TLV and Packet TLV registries of <xref target="RFC5444"/>, to be used (and shared) among MANET routing protocol security extensions.  Finally, this document establishes two IANA registries for code-points for hash functions and cryptographic functions for use by protocols adhering to <xref target="RFC5444"/>.
		</t>
		
		
		<t>With respect to <xref target="RFC5444"/>, this document:
			<list style="symbols">
				<t>is intended to be used in the non-normative but intended mode of use of <xref target="RFC5444"/> as described in its Appendix B.</t>
				<t>is a specific example of the Security Considerations section of <xref target="RFC5444"/> (the authentication part).</t>
			</list>
		</t>
    </section>

    <section title="Protocol Overview and Functioning" anchor="overview">
      <t>
      	This specification does not describe a protocol, nor does it mandate specific router or protocol behavior. It represents a purely syntactical representation of security related information for use with <xref target="RFC5444"/> messages and packets, as well as sets up IANA registrations and registries.
      </t>
    </section>

      <section title="General Signature TLV Structure" anchor="signatureTLVformat">
		<t>
		   The following data structure allows the representation of a cryptographic signature, including specification of the appropriate hash function and cryptographic algorithm used for calculating the signature. This &lt;signature&gt; data structure is specified, using the regular expression syntax of <xref target="RFC5444"/>, as:
		</t>
		<figure>
			<artwork>
          &lt;signature&gt; := &lt;hash-function&gt;
                         &lt;cryptographic-algorithm&gt;
                         &lt;signature-value&gt;
			</artwork>
		</figure>
	<t>
   where:
	<list style="hanging">
		<t hangText="&lt;hash-function&gt;"> is an 8-bit unsigned integer field specifying the hash function according to <xref target="table_hash_registry"/>.
		</t>
		<t hangText="&lt;cryptographic-algorithm&gt;"> is an 8-bit unsigned integer field specifying the cryptographic function according to <xref target="table_cryptographic_registry"/>.
		</t>
		<t hangText="&lt;signature-value&gt;"> is an unsigned integer field, whose length is &lt;tlv-length&gt;-2, and which contains the cryptographic signature.
		</t>
		
	</list>
	
	The basic version of this TLV assumes that calculating the signature can be decomposed into:
		<list style="hanging">
			<t>signature-value = cryptographic-function(hash-function(message))</t>
		</list>
	with cryptographic-function and hash-function being selected from <xref target="table_hash_registry"/> and <xref target="table_cryptographic_registry"/> respectively (where either of them can be the identity function -- indicated by "none" in the registry). 
	
	The type extension 0 is assumed to indicate this decomposition.  Otherwise, if a signature is not decomposable in that way, the type extension field can be used for indication how signatures are to be calculated.
	</t>
	
	<t>
	The algorithm that is used for calculating the hash function is selected from one of those listed in <xref target="table_hash_registry"/>. Furthermore, &lt;hash-function&gt; corresponds to the number in that table assigned by IANA.</t>  
	
	<t>The algorithm that is used for calculating the cryptographic algorithm is selected from one of those listed in <xref target="table_cryptographic_registry"/>. Furthermore, &lt;cryptographic-algorithm&gt; corresponds to the number in that table assigned by IANA. If the selected hash function is "none" (0), the cryptographic function SHOULD NOT be "none" (0).
	</t>
	
	<t>
	The rationale for separating the hash function and the cryptographic function into two octets instead of having all combinations in a single octet -- possibly as TLV type extension -- is twofold: 
	First, if further hash or cryptographic functions are added in the future, the number space might not be continuous any more.  More importantly, the number space of 256 possible combinations is rapidly exhausted. For example, having only 16 different hash functions and 16 different cryptographic functions would lead to exhaustion.  As new or improved cryptographic mechanism are continuously being developed and introduced, this format should be able to accommodate such for the foreseeable future.
	</t>
	
	<t>
	The rationale for not including a field that lists parameters of the cryptographic signature in the TLV is the following: Before being able to to validate a cryptographic signature, routers have to exchange keys (e.g. public keys). Any additional parameters can be exchanged together with the keys in this bootstrap process. It is therefore not necessary, and would even entail an extra overhead, to transmit the parameters within every message.
	
	One inherently included parameter is the length of the signature, which is tlv-length - 2 and which depends on the choice of the cryptographic function.
	</t>
	</section>

      <section title="General Timestamp TLV Structure" anchor="timestampTLVformat">
		<t>
		   The following data structure allows the representation of a timestamp. This &lt;timestamp&gt; data structure is specified as:
		</t>
		<figure>
	<artwork>
       &lt;timestamp&gt; := &lt;time-value&gt;
	</artwork>
	</figure>
	<t>
   where:
	<list style="hanging">
		<t hangText="&lt;time-value&gt;"> is an unsigned integer field, whose length is &lt;tlv-length&gt;, and which contains the timestamp. The value of this variable is to be interpreted by the routing protocol as specified by the type extension of the Timestamp TLV (refer to <xref target="table_IANA_packet_TLV_types"/>).
		</t>
	</list>
	
	 A timestamp is essentially "freshness information".  As such, its setting and interpretation is to be determined by the routing protocol (or the extension to a routing protocol) that uses it, and may e.g. correspond to a UNIX-timestamp, GPS timestamp or a simple sequence number.  This is out of the scope of this specification.
	</t>
	  </section>
	  
    <section title="Message TLVs" anchor="messageSignatures">
      <t>
      	Two Message TLVs are defined, for including the cryptographic signature of a message, and for including the timestamp indicating the time at which the cryptographic signature was calculated.
      </t>
     

      <section title="Message SIGNATURE TLV" anchor="signatureTLV">
		<t>
			A Message SIGNATURE TLV is an example of a SIGNATURE TLV as described in <xref target="signatureTLVformat"/>. When determining the &lt;signature-value&gt; for a message, the signature is calculated over the entire message with the following considerations:
			<list style="symbols">
				<t>
					the fields &lt;msg-hop-limit&gt; and &lt;msg-hop-count&gt; MUST be both assumed to have the value 0 (zero).
				</t>
				<t>
					all Message SIGNATURE TLVs MUST be removed before calculating the signature, and the message size as well as the Message TLV block size MUST be recalculated accordingly. The TLVs can be restored after having calculated the signature value.
				</t>
			</list>
	</t>

	</section>

      <section title="Message TIMESTAMP TLV" anchor="timestampTLV">
		<t>
			A Message TIMESTAMP TLV is an example of a TIMESTAMP TLV as described in <xref target="timestampTLVformat"/>. If a message contains a TIMESTAMP TLV and a SIGNATURE TLV, the TIMESTAMP TLV SHOULD be added first to the message, in order to include it in the calculation of the signature.
	</t>
      </section>

      
    </section>

    <section title="Packet TLVs" anchor="packetSignatures">
      <t>
      	Two Packet TLVs are defined, for including the cryptographic signature of a packet, and for including the timestamp indicating the time at which the cryptographic signature was calculated.
      </t>
     

      <section title="Packet SIGNATURE TLV" anchor="packetsignatureTLV">
		<t>
			A Packet SIGNATURE TLV is an example of a SIGNATURE TLV as described in <xref target="signatureTLVformat"/>. When calculating the &lt;signature-value&gt; for a Packet, the signature is calculated over the entire Packet, including the packet header, all Packet TLVs (other than Packet SIGNATURE TLVs) and all included Messages and their message headers.
	</t>      
	
      <section title="Packet TIMESTAMP TLV" anchor="packettimestampTLV">
		<t>
			A Packet TIMESTAMP TLV is an example of a TIMESTAMP TLV as described in <xref target="timestampTLVformat"/>.
	</t>
      </section>

      </section>
     </section>
<!--
      <section title="ENCRYPTED_MESSAGE TLV" anchor="encryptedMessageTlv">
        <t>
        	The ENCRYPTED_MESSAGE TLV is a packet TLV that may carry an  encrypted message. The value of the TLV is set to the byte array representing  a packetbb message. The type extension specifies the used encryption algorithm.
        </t>
        
        <texttable anchor="table_packet_enc_TLV_fields" title="Values of the TLV fields">
          <ttcol align='center'>&lt;tlv-type&gt;</ttcol>
          <ttcol align='center'>Content</ttcol>
          <c>&lt;tlv-type&gt;</c>
          <c>ENCRYPTED_MESSAGE</c>
          <c>&lt;tlv-flags&gt;</c>
          <c>refer to <xref target="table_packet_enc_TLV_flags"/></c>
          <c>&lt;tlv-type-ext&gt;</c>
          <c>refer to <xref target="table_packet_enc_TLV_ext"/></c>
          <c>&lt;length&gt;</c>
          <c>(length of encrypted message in octets)</c>
          <c>&lt;value&gt;</c>
          <c>octets representing the encrypted message</c>
        </texttable>


        <texttable anchor="table_packet_enc_TLV_flags" 
           title="Values of the &lt;tlv-flags&gt; field">
          <ttcol align='center'>TLV flag</ttcol>
          <ttcol align='center'>Content</ttcol>
          <c>thastypeext</c>
          <c>set ('0')</c>
          <c>thassingleindex</c>
          <c>cleared ('0')</c>
          <c>thasmultiindex</c>
          <c>cleared ('0')</c>
          <c>thasvalue</c>
          <c>set ('1')</c>
          <c>thasextlen</c>
          <c>cleared ('0') if the encrypted message is not longer than 255 
             octets, otherwise set ('1')</c>
          <c>tismultivalue</c>
          <c>cleared ('0')</c>
        </texttable>

        <texttable anchor="table_packet_enc_TLV_ext" 
            title="Possible values for the TLV extension field">
          <ttcol align='center'>TLV extension</ttcol>
          <ttcol align='center'>Encryption algorithm</ttcol>
          <c>RSA</c>
          <c>RSA ([RSA])</c>

          <c>ECC</c>
          <c>ECC ([ECC])</c>

          <c>AES</c>
          <c>AES ([AES])</c>


        </texttable>
      </section>

      
    </section>
-->

    <section anchor="IANA" title="IANA Considerations">

		<section title="TLV Registrations">
      <t>
      	This specification defines two Message TLV types which must be allocated from the 0-127 range of the "Assigned Message TLV Types" repository of <xref target="RFC5444"/> as specified in <xref target="table_IANA_message_TLV_types"/> and two Packet TLV types which must be allocated from the 0-223 range of the "Assigned Packet TLV Types" repository of <xref target="RFC5444"/> as specified in <xref target="table_IANA_packet_TLV_types"/>.
		</t>
		<t>
         IANA is requested to assign the same numerical value to the Message
         TLV and Packet TLV types with the same name.
        </t>
        
      <section title="Expert Review: Evaluation Guidelines">
        <t>
        	For the registries for TLV type extensions where an Expert Review is required, the designated expert SHOULD take the same general recommendations into consideration as are specified by 
           <xref target="RFC5444"/>.</t>
      </section>

      <section title="Message TLV Type Registrations">
      	<t>
      	The Message TLVs as specified in <xref target="table_IANA_message_TLV_types"/> must be allocated from the "Message TLV Types" namespace of <xref target="RFC5444"/>.</t>
        <texttable anchor="table_IANA_message_TLV_types" title="Message TLV types">
          <ttcol align='center'>Name</ttcol>
          <ttcol align='center'>Type</ttcol>
          <ttcol align='center'>Type Extension</ttcol>
          <ttcol align='center'>Description</ttcol>
          <c>SIGNATURE</c>
          <c>TBD1</c>
          <c>0</c>
          <c>Signature of a message</c>
          <c></c>
          <c></c>
          <c>1-223</c>
          <c>Expert Review</c>
          <c></c>
          <c></c>
          <c>224-255</c>
          <c>Experimental Use</c>
          <c>TIMESTAMP</c>
          <c>TBD2</c>
          <c>0</c>
          <c>Unsigned timestamp of arbitrary length, given by the tlv-length field. The timestamp is assumed to increase strictly monotonously by steps of 1. The MANET routing protocol has to define how to interpret this timestamp</c>
          <c></c>
          <c></c>
          <c>1</c>
          <c>Unsigned 32-bit timestamp as specified in <xref target="POSIX"/></c>
          <c></c>
          <c></c>
          <c>2</c>
          <c>NTP timestamp format as defined in <xref target="RFC4330"/></c>
          <c></c>
          <c></c>
          <c>3</c>
          <c>Signed timestamp of arbitrary length with no constraints such as monotonicity. In particular, it may represent any random value</c>
          <c></c>
          <c></c>
          <c>4-223</c>
          <c>Expert Review</c>
          <c></c>
          <c></c>
          <c>224-255</c>
          <c>Experimental Use</c>
        </texttable>
      </section>

      <section title="Packet TLV Type Registrations">
      	<t>
      	The Packet TLVs as specified in <xref target="table_IANA_packet_TLV_types"/> must be allocated from the "Packet TLV Types" namespace of <xref target="RFC5444"/>.</t>
        <texttable anchor="table_IANA_packet_TLV_types" title="Packet TLV types">
          <ttcol align='center'>Name</ttcol>
          <ttcol align='center'>Type</ttcol>
          <ttcol align='center'>Type Extension</ttcol>
          <ttcol align='center'>Description</ttcol>
          <c>SIGNATURE</c>
          <c>TBD3</c>
          <c>0</c>
          <c>Signature of a packet</c>
          <c></c>
          <c></c>
          <c>1-223</c>
          <c>Expert Review</c>
          <c></c>
          <c></c>
          <c>224-255</c>
          <c>Experimental Use</c>
          <c>TIMESTAMP</c>
          <c>TBD4</c>
          <c>0</c>
          <c>Unsigned timestamp of arbitrary length, given by the tlv-length field. The timestamp is assumed to increase strictly monotonously by steps of 1. The MANET routing protocol has to define how to interpret this timestamp</c>
          <c></c>
          <c></c>
          <c>1</c>
          <c>Unsigned 32-bit timestamp as specified in <xref target="POSIX"/></c>
          <c></c>
          <c></c>
          <c>2</c>
          <c>NTP timestamp format as defined in <xref target="RFC4330"/></c>
          <c></c>
          <c></c>
          <c>3</c>
          <c>Signed timestamp of arbitrary length with no constraints such as monotonicity. In particular, it may represent any random value</c>
          <c></c>
          <c></c>
          <c>4-223</c>
          <c>Expert Review</c>
          <c></c>
          <c></c>
          <c>224-255</c>
          <c>Experimental Use</c>

        </texttable>
      </section>
    </section>

	<section title="New IANA registries">
	
		<t>
			This document specifies some values where IANA registries are required.
		</t>
	      <section title="Expert Review: Evaluation Guidelines">
        	<t>
        		For the registries for the following tables where an Expert Review is required, the designated expert SHOULD take the same general recommendations into consideration as are specified by  <xref target="RFC5444"/>.
           </t>
      </section>
	<section title="Hash-Function Registry">
	<t>
		IANA is requested to create a new registry for the hash functions that can be used when creating a signature. The initial assignments and allocation policies are specified in <xref target="table_hash_registry"/>.
		
	</t>
    <texttable anchor="table_hash_registry" title="Hash-Function registry">
       <ttcol align='center'>Hash function value</ttcol>
       <ttcol align='center'>Algorithm</ttcol>
       <ttcol align='center'>Description</ttcol>
       <c>0</c>
       <c>none</c>
       <c>The "identity function": the hash value of a message is the message itself</c>
       <c>1</c>
       <c>MD5</c>
       <c>The hash function as specified in <xref target="RFC1321"/></c>
       <c>2</c>
       <c>SHA1</c>
       <c>The hash function as specified in <xref target="RFC3174"/></c>
       <c>3</c>
       <c>SHA256</c>
       <c>The hash function as specified in <xref target="SHA256"/></c>
       <c>4-223</c>
       <c></c>
       <c>Expert Review</c>
       <c>224-255</c>
       <c></c>
       <c>Experimental Use</c>
    </texttable>
	</section>

	<section title="Cryptographic Algorithm Registry">
	<t>
		IANA is requested to create a new registry for the cryptographic function. Initial assignments and allocation policies are specified in <xref target="table_cryptographic_registry"/>.
		
	</t>
    <texttable anchor="table_cryptographic_registry" title="Cryptographic algorithm registry">
        <ttcol align='center'>Cryptographic algorithm value</ttcol>
        <ttcol align='center'>Algorithm</ttcol>
        <ttcol align='center'>Description</ttcol>
        <c>0</c>
        <c>none</c>
        <c>The "identity function": the value of an encrypted hash is the hash itself</c>
        <c>1</c>
        <c>RSA</c>
        <c>RSA as specified in <xref target="RFC2437"/></c>
        <c>2</c>
        <c>DSA</c>
        <c>DSA as specified in <xref target="DSA"/></c>
        <c>3</c>
        <c>HMAC</c>
        <c>HMAC as specified in <xref target="RFC2104"/></c>
        <c>4</c>
        <c>3DES</c>
        <c>3DES as specified in <xref target="3DES"/></c>
        <c>5</c>
        <c>AES</c>
        <c>AES as specified in <xref target="AES"/></c>
        <c>6-223</c>
       <c></c>
       <c>Expert Review</c>
       <c>224-255</c>
       <c></c>
       <c>Experimental Use</c>
    </texttable>
		

	
	</section>
</section>	
</section>
    <section anchor="Security" title="Security Considerations">
      <t>
      	This document does not specify a protocol itself. However, it provides a syntactical component for cryptographic signatures of messages and packets as defined in <xref target="RFC5444"/>. It can be used to address security issues of a protocol or extension that uses the component specified in this document. As such, it has the same security considerations as <xref target="RFC5444"/>.</t>
      	
      	<t>In addition, a protocol that includes this component MUST specify the usage as well as the security that is attained by the cryptographic signatures of a message or a packet.</t>
      	
      	<t>As an example, a routing protocol that uses this component to reject "badly formed" messages if a control message does not contain a valid signature, should indicate the security assumption that if the signature is valid, the message is considered valid. It also should indicate the security issues that are counteracted by this measure (e.g. link or identity spoofing) as well as the issues that are not counteracted (e.g. compromised keys). 
      	
      </t>
    </section>

    <section anchor="Acknowledgements" title="Acknowledgements">
      <t>The authors would like to thank Jerome Milan (Ecole Polytechnique) for his advice as cryptographer. In addition, many thanks to Alan Cullen (BAE), Justin Dean (NRL), Christopher Dearlove (BAE), and Henning Rogge (FGAN) for their constructive comments on the document.</t>
    </section>
  </middle>

  <back>
    <references title="Normative References">

    
  <reference anchor="RFC2119">
    <front>
      <title abbrev="foo">Key words for use in RFCs to Indicate Requirement Levels</title>
      <author initials="S." surname="Bradner" fullname="Scott Bradner">
        <organization abbrev="HU">Harvard University</organization>
      </author>
      <date month="March" year="1997" />
    </front>
    <seriesInfo name="RFC" value="2119" />
    <seriesInfo name="BCP" value="14" />
  </reference>
  


  <reference anchor="RFC5444">
    <front>
      <title abbrev="RFC5444">Generalized MANET Packet/Message Format</title>
        <author initials="T.H." surname="Clausen" fullname="Thomas Heide Clausen">
          <organization abbrev="X">Ecole Polytechnique, France</organization>
        </author>
        <author initials="C.M." surname="Dearlove" fullname="Christopher Dearlove">
          <organization abbrev="BAE">BAE Systems Advanced Technology Centre, UK</organization>
        </author>
        <author initials="J.W." surname="Dean" fullname="Justin W. Dean">
          <organization abbrev="NRL">Naval Research Laboratory, USA</organization>
        </author>
        <author initials="C." surname="Adjih" fullname="Cedric Adjih">
          <organization>INRIA Rocquencourt</organization>
        </author>
        <date month="February" year="2009" />
      </front>
      <seriesInfo name="RFC" value="5444"/>
    </reference>
    
    </references>

    <references title="Informative References">


<!--
    <reference anchor='RFC1319'> 
  		<front>
			<title abbrev='MD2 Message-Digest Algorithm'>The MD2 Message-Digest Algorithm</title>
			<author initials='B.' surname='Kaliski' fullname='Burton S. Kaliski Jr.'>
 				<organization>RSA Laboratories</organization>
  				<address>
					<postal>
						<street>10 Twin Dolphin Drive</street>
						<city>Redwood City</city>
						<region>CA</region>
						<code>94065</code>
						<country>US</country>
					</postal>
					<phone>+1 415 595 8782</phone>
					<facsimile>+1 415 595 4126</facsimile>
					<email>burt@rsa.com</email>
				</address>
			</author>
			<date year='1992' month='April' />
		</front>
		<seriesInfo name='RFC' value='1319' />
		<format type='TXT' octets='25661' target='ftp://ftp.isi.edu/in-notes/rfc1319.txt' />
  </reference>
  
  <reference anchor='RFC1320'>
	<front>
	<title abbrev='MD4 Message-Digest Algorithm'>The MD4 Message-Digest Algorithm</title>
	<author initials='R.' surname='Rivest' fullname='Ronald L. Rivest'>
	<organization>Massachusetts Institute of Technology (MIT), Laboratory for Computer Science, RSA Data Security, Inc.</organization>
	<address>
	<postal>
	<street>545 Technology Square</street>
	<street>NE43-324</street>
	<city>Cambridge</city>
	<region>MA</region>
	<code>02139-1986</code>
	<country>US</country></postal>
	<phone>+1 617 253 5880</phone>
	<email>rivest@theory.lcs.mit.edu</email></address></author>
	<date year='1992' month='April' /></front>
	
	<seriesInfo name='RFC' value='1320' />
	<format type='TXT' octets='32407' target='ftp://ftp.isi.edu/in-notes/rfc1320.txt' />
  </reference>
  -->
  
  <reference anchor='RFC1321'>
	<front>
	<title abbrev='MD5 Message-Digest Algorithm'>The MD5 Message-Digest Algorithm</title>
	<author initials='R.' surname='Rivest' fullname='Ronald L. Rivest'>
		<organization>Massachusetts Institute of Technology, (MIT) Laboratory for Computer Science</organization>
	</author>
	<date year='1992' month='April' /></front>
	
	<seriesInfo name='RFC' value='1321' />
	<format type='TXT' octets='35222' target='ftp://ftp.isi.edu/in-notes/rfc1321.txt' />
  </reference>
		
		

  <reference anchor='RFC3174'>
	<front>
	<title>US Secure Hash Algorithm 1 (SHA1)</title>
	<author initials='D.' surname='Eastlake' fullname='D. Eastlake'>
	<organization /></author>
	<author initials='P.' surname='Jones' fullname='P. Jones'>
	<organization /></author>
	<date year='2001' month='September' />
	</front>
	
	<seriesInfo name='RFC' value='3174' />
	<format type='TXT' octets='35525' target='ftp://ftp.isi.edu/in-notes/rfc3174.txt' />
  </reference>
  
  <reference anchor='RFC4330'> 
    <front>
    	<title>Simple Network Time Protocol (SNTP) Version 4 for IPv4, IPv6 and OSI</title>
    	<author initials='D.' surname='Mills' fullname='D. Mills'>
    	<organization /></author>
    	<date year='2006' month='January' />
    </front>
    <seriesInfo name='RFC' value='4330' />
   <format type='TXT' octets='67930' target='ftp://ftp.isi.edu/in-notes/rfc4330.txt' />
 </reference>

  <reference anchor="NHDP">
    <front>
      <title>MANET Neighborhood Discovery Protocol (NHDP)</title>
      <author initials="T.H." surname="Clausen" fullname="Thomas Heide Clausen">
        <organization abbrev="X">Ecole Polytechnique, France</organization>
      </author>
      <author initials="J.W." surname="Dean" fullname="Justin W. Dean">
        <organization abbrev="NRL">Naval Research Laboratory, USA</organization>
      </author>
      <author initials="C.M." surname="Dearlove" fullname="Christopher Dearlove">
        <organization>BAE Systems Advanced Technology Centre, UK</organization>
      </author>
      <date month="July" year="2009"/>
    </front>
    <seriesInfo name="work in progress" value="draft-ietf-manet-nhdp-10.txt" />
  </reference>

<!--
  <reference anchor="OLSRv2">
    <front>
      <title>The Optimized Link State Routing Protocol version 2</title>
      <author initials="T.H." surname="Clausen" fullname="Thomas Heide Clausen">
        <organization abbrev="X">Ecole Polytechnique, France</organization>
      </author>
      <author initials="C.M." surname="Dearlove" fullname="Christopher Dearlove">
        <organization>BAE Systems Advanced Technology Centre, UK</organization>
      </author>
      <author initials="P." surname="Jacquet" fullname="Philippe Jacquet (ed.)">
        <organization abbrev="INRIA">Project Hipercom, INRIA Rocquencourt, France</organization>
       </author>
        <date month="March" year="2009"/>
        
    </front>
    <seriesInfo name="work in progress" value="draft-ietf-manet-olsrv2-08.txt" />
  </reference>
  -->
  
  <!--
  <reference anchor="RSA">
    <front>
      <title>A method for obtaining digital signatures and public-key cryptosystems</title>
      <author initials="R.L." surname="Rivest" fullname="R.L. Rivest">
        <organization></organization>
      </author>
      <author initials="A." surname="Shamir" fullname="A. Shamir">
        <organization></organization>
      </author>
      <author initials="L." surname="Adleman" fullname="L. Adleman">
        <organization></organization>
       </author>
        <date month="February" year="1978"/>
    </front>
    <seriesInfo name="Communications of the ACM" value="21(2):120-126" />
  </reference>
  -->
  
  <reference anchor='RFC2437'>
	<front>
		<title abbrev='PKCS #1'>PKCS #1: RSA Cryptography Specifications Version 2.0</title>
		<author initials='B.' surname='Kaliski' fullname='Burt Kaliski'>
			<organization>RSA Laboratories East</organization>
		</author>
		<author initials='J.' surname='Staddon' fullname='Jessica Staddon'>
			<organization>RSA Laboratories West</organization>
		</author>
		<date year='1998' month='October' />
	</front>
	
	<seriesInfo name='RFC' value='2437' />
	<format type='TXT' octets='73529' target='ftp://ftp.isi.edu/in-notes/rfc2437.txt' />
	<format type='HTML' octets='93905' target='http://xml.resource.org/public/rfc/html/rfc2437.html' />
	<format type='XML' octets='76587' target='http://xml.resource.org/public/rfc/xml/rfc2437.xml' />
  </reference>

  
  <reference anchor='RFC2104'>
		<front>
		<title abbrev='HMAC'>HMAC: Keyed-Hashing for Message Authentication</title>
		<author initials='H.' surname='Krawczyk' fullname='Hugo Krawczyk'>
			<organization></organization>
		</author>
		<author initials='M.' surname='Bellare' fullname='Mihir Bellare'>
			<organization></organization>
		</author>
		<author initials='R.' surname='Canetti' fullname='Ran Canetti'>
			<organization></organization>
		</author>
		<date year='1997' month='February' />
	    </front>
		
		<seriesInfo name='RFC' value='2104' />
		<format type='TXT' octets='22297' target='ftp://ftp.isi.edu/in-notes/rfc2104.txt' />
   </reference>

    <reference anchor="AES">
    <front>
      <title>Advanced Encryption Standard (AES)</title>
      <author initials="" surname="National Institute of Standards & Technology" fullname="">
        <organization></organization>
      </author>
      <date month="November" year="2001"/>
        
    </front>
     <seriesInfo name="FIPS" value="197" />
  </reference>
  
  
  
  <reference anchor="DSA">
    <front>
      <title>Digital Signature Standard</title>
      <author initials="" surname="National Institute of Standards & Technology" fullname="">
        <organization></organization>
      </author>
      <date month="May" year="1994"/>
        
    </front>
     <seriesInfo name="NIST, FIPS PUB" value="186" />
  </reference>
  
  
  <reference anchor="3DES">
    <front>
      <title>Triple Data Encryption Algorithm Modes of Operation</title>
      <author initials="" surname="American National Standards Institute" fullname="">
        <organization></organization>
      </author>
      <date month="" year="1998"/>
        
    </front>
     <seriesInfo name="ANSI" value="X9.52-1998" />
  </reference>

  
  <reference anchor="SHA256">
    <front>
      <title>Secure Hash Algorithm</title>
      <author initials="" surname="National Institute of Standards and Technology" fullname="">
        <organization></organization>
      </author>
 
        <date month="August" year="2002"/>
        
    </front>
     <seriesInfo name="NIST FIPS" value="180-2" />
  </reference>
  
  
    
  <reference anchor="POSIX">
    <front>
      <title>1003.1-2008 Standard for Information Technology - Portable Operating System Interface (POSIX)</title>
      <author initials="" surname="IEEE Computer Society" fullname="">
        <organization></organization>
      </author>
 
        <date month="December" year="2008"/>
        
    </front>
     <seriesInfo name="Base Specifications" value="Issue 7" />
  </reference>
  
  </references>

    <section title="Examples">
      <section title="Example of a Signed Message">
        <t>
        	The sample message depicted in <xref target="exampleMessage"/> is  taken from the appendix of <xref target="RFC5444"/>. However, a SIGNATURE Message TLV has been added. It is assumed that the SIGNATURE TLV type is lesser than the TLV type of the second message TLV (i.e. it comes first  in the order of Message TLVs). The TLV value represents a 16 octet long signature of the whole message.
        </t>
        
        <figure anchor="exampleMessage" title="Example message with signature">
          <artwork>
   0                   1                   2                   3  
   0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1
  +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
  |0 0 0 0 1 0 0 0|    Packet Sequence Number     | Message Type  |
  +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
  |1 1 1 1 0 0 1 1|0 0 0 0 0 0 0 0 0 1 0 0 1 1 0 0|   Orig Addr   |
  +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
  |           Originator Address (cont)           |   Hop Limit   |
  +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
  |   Hop Count   |    Message Sequence Number    |0 0 0 0 0 0 0 0|
  +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
  |0 0 0 1 1 1 1 0|   SIGNATURE   |0 0 0 1 0 0 0 0|0 0 0 1 0 0 1 0|
  +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
  |   Hash Func   |  Crypto Func  |        Signature Value        |
  +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
  |                    Signature Value (cont)                     |
  +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
  |                    Signature Value (cont)                     |
  +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
  |                    Signature Value (cont)                     |
  +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
  |    Signature Value (cont)     |   TLV Type    |0 0 0 1 0 0 0 0|
  +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
  |0 0 0 0 0 1 1 0|                     Value                     |
  +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
  |                 Value (cont)                  |0 0 0 0 0 0 1 0|
  +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
  |0 0 1 1 0 0 0 0|0 0 0 0 0 0 1 0|              Mid              |
  +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
  |              Mid              | Prefix Length |0 0 0 0 0 0 0 0|
  +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
  |0 0 0 0 0 0 0 0|0 0 0 0 0 0 1 1|1 0 0 0 0 0 0 0|0 0 0 0 0 0 1 0|
  +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
  |             Head              |              Mid              |
  +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
  |              Mid              |              Mid              |
  +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
  |0 0 0 0 0 0 0 0 0 0 0 0 1 0 0 1|   TLV Type    |0 0 0 1 0 0 0 0|
  +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
  |0 0 0 0 0 0 1 0|             Value             |   TLV Type    |
  +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
  |0 0 1 0 0 0 0 0|  Index Start  |  Index Stop   |
  +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
          </artwork>
        </figure>
      </section>
    </section>
  </back>
</rfc>
