<?xml version="1.0" encoding="UTF-8"?>
<?xml-stylesheet type='text/xsl' href='rfc2629.xslt' ?>

<!DOCTYPE rfc SYSTEM "rfc2629.dtd" [


<!ENTITY RFC2119 SYSTEM "http://xml.resource.org/public/rfc/bibxml/reference.RFC.2119.xml">
<!ENTITY RFC4493 SYSTEM "http://xml.resource.org/public/rfc/bibxml/reference.RFC.4493.xml">
<!ENTITY RFC4543 SYSTEM "http://xml.resource.org/public/rfc/bibxml/reference.RFC.4543.xml">
<!ENTITY RFC5116 SYSTEM "http://xml.resource.org/public/rfc/bibxml/reference.RFC.5116.xml">
<!ENTITY RFC5297 SYSTEM "http://xml.resource.org/public/rfc/bibxml/reference.RFC.5297.xml">
<!ENTITY RFC7301 SYSTEM "http://xml.resource.org/public/rfc/bibxml/reference.RFC.7301.xml">
<!ENTITY RFC7525 SYSTEM "http://xml.resource.org/public/rfc/bibxml/reference.RFC.7525.xml">
<!ENTITY RFC8174 SYSTEM "http://xml.resource.org/public/rfc/bibxml/reference.RFC.8174.xml">
<!ENTITY RFC8446 SYSTEM "http://xml.resource.org/public/rfc/bibxml/reference.RFC.8446.xml">
<!ENTITY RFC8915 SYSTEM "http://xml.resource.org/public/rfc/bibxml/reference.RFC.8915.xml">
]>



<?rfc toc="yes"?>        <!-- generate a ToC -->
<?rfc tocindent="yes"?>
<?rfc tocdepth="4"?>     <!-- the number of levels of subsections in ToC. default: 3 -->
<?rfc sortrefs="yes"?>   <!-- sort the reference entries alphabetically -->
<?rfc symrefs="yes"?>    <!-- use symbolic references tags, i.e, [RFC2119] instead of [1] -->
<?rfc strict="yes"?>     <!-- give errors regarding ID-nits and DTD validation -->
<?rfc compact="yes"?>    <!-- do not start each main section on a new page -->
<?rfc subcompact="yes"?>  <!-- keep one blank line between list items -->
<?rfc comments="yes"?>
<?rfc inline="yes"?>
<?rfc version="3"?>      <!-- xml2rfc v2v3 conversion 2.38.1 -->

<rfc category="std" docName="draft-langer-ntp-nts-for-ptp-01" ipr="trust200902">
  <front>
    <title abbrev="NTS4PTP">NTS4PTP - Key Management System for the Precision Time Protocol 
	                        Based on the Network Time Security Protocol </title>

    <author initials="M." surname="Langer" fullname="Martin Langer">
      <organization abbrev="Ostfalia University" >Ostfalia University of Applied Sciences</organization>
      <address>
	  <postal>
          <street>Salzdahlumer Straße 46/48</street>
          <city>Wolfenbüttel</city>
          <region></region>
          <code>38302</code>
          <country>Germany</country>
        </postal>
        <email>mart.langer@ostfalia.de</email>
      </address>
    </author>

	<author initials="R." surname="Bermbach" fullname="Rainer Bermbach">
      <organization abbrev="Ostfalia University" >Ostfalia University of Applied Sciences</organization>
      <address>
	  	  <postal>
          <street>Salzdahlumer Straße 46/48</street>
          <city>Wolfenbüttel</city>
          <region></region>
          <code>38302</code>
          <country>Germany</country>
        </postal>
        <email>r.bermbach@ostfalia.de</email>
      </address>
    </author>


    <date day="8" month="March" year="2021"/>

    <area>Internet</area>
    <workgroup>Network Time Protocol</workgroup>
    <keyword>Internet-Draft</keyword>

    <abstract>

<t>This document defines a key management service for automatic key management 
for the integrated security mechanism (Prong A) of IEEE Std 1588™-2019 described there 
in Annex P. It implements a key management for immediate security processing complementing 
the exemplary GDOI proposal in P.2.1.2.1. The key management service is based on the 
“NTS Key Establishment” protocol defined in IETF RFC 8915 for securing NTP, but works 
completely independent from NTP.</t>

    </abstract>

  </front>
 

  <middle>

<section anchor="notational-conventions" title="Notational Conventions">

<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 BCP 14 <xref target="RFC2119"/> <xref target="RFC8174"/>
when, and only when, they appear in all capitals, as shown here.</t>

</section>

<section anchor="introduction" title="Key Management Using Network Time Security">

<t>Many networks include both PTP and NTP at the same time. Furthermore, many time server 
appliances that are capable of acting as the Grandmaster of a PTP Network are also capable 
of acting as an NTP server. For these reasons it is likely to be easier both for the time 
server manufacturer and the network operator if PTP and NTP use a key management system 
based on the same technology. The Network Time Security (NTS) protocol was specified by 
the Internet Engineering Task Force (IETF) to protect the integrity of NTP messages 
<xref target="RFC8915"/>. Its NTS Key Establishment sub-protocol is secured by the Transport Layer Security 
(TLS 1.3, IETF RFC 8446 <xref target="RFC8446"/>) mechanism. TLS is used to protect numerous popular network protocols, 
so it is present in many networks. For example, HTTPS, the predominant secure web protocol 
uses TLS for security. Since many PTP capable network appliances have management interfaces 
based on HTTPS, the manufacturers are already implementing TLS. This document outlines how 
the NTS Key Establishment protocol of IETF RFC 8915 can be expanded for use as a PTP key 
management mechanism <xref target="Langer_et_al._2020"/> for immediate security processing complementing the exemplary 
GDOI proposal in the IEEE Std 1588-2019 <xref target="IEEE1588-2019"/>. As a key establishment server for NTP should be 
implemented stateless which is not necessary for PTP systems, suitable new NTS messages 
are to be defined in this document.</t>

<t>Though the key management for PTP is based on the NTS Key Establishment protocol for NTP, 
it works completely independent of NTP. The key management system uses the procedures 
described in IETF RFC 8915 for the NTS-KE and expands it with new NTS messages for PTP. 
It may be applied in a Key Establishment server (KE server) that already manages NTP but 
can also be operated only handling KE for PTP. Even when the PTP network is isolated from 
the Internet, a Key Establishment server can be installed in that network providing the 
PTP instances with necessary key and security parameters.</t>

<t>The KE server may often be implemented as a separate unit. It also may be collocated 
with a PTP instance, e.g. the Grandmaster. In the latter case communication between the 
KE server program and the PTP instance program needs to be implemented in a secure way 
if TLS communication (e.g. via local host) is not or cannot be used. </t> 

<t>Using the expanded NTS Key Establishment protocol for the NTS key management for PTP, 
NTS4PTP provides two principle approaches specified in this document.</t>




<t>1. Group-based approach:</t>
            <t><list style="symbols">
			  <t>Definition of one or more security groups in the PTP network,</t>
              <t>very suitable for PTP multicast mode and mixed multicast/unicast mode,</t>
              <t>suitable for unicast mode in small subgroups of very few participants 
			  (Group-of-2, Go2) but poor scaling and more administration work,</t>
            </list>
            </t>
<t>2. Ticket-based approach</t>
            <t><list style="symbols">
			  <t>secured (end-to-end) PTP unicast communication between requester and grantor,</t>
              <t>no group binding necessary,</t>
              <t>very suitable for native PTP unicast mode, because of good scaling,</t>
              <t>a bit more complex NTS message handling.</t>
            </list>
            </t>


<t>This document describes the structure and usage of these two approaches in their application 
as a key management system for the integrated security mechanism (Prong A) of IEEE Std 1588-2019. 
<xref target="key-distribution"/> starts with a description of the principle key distribution 
mechanism, continues with details of the various group-based options (<xref target="exchange-group-based"/>) 
and the ticket-based unicast mode (<xref target="exchange-ticket-based"/>) before it ends with 
more general topics in <xref target="general-topics"/> for example the key update process and 
finally an overview of the newly defined NTS messages in <xref target="overview-nts-messages"/>. 
<xref target="nts-messages-4-ptp"/> gives all the details necessary to construct all records forming 
the particular NTS messages. <xref target="new-ticket-tlv"/> depicts details of a TICKET TLV needed 
to transport encrypted security information in PTP unicast requests. The following 
<xref target="auth-tlv-parameters"/> mentions specific 
parameters used in the PTP AUTHENTICATION TLV when working with the NTS4PTP key management system. 
<xref target="iana-considerations"/> and <xref target="security-considerations"/> discuss IANA 
respectively security considerations.</t>


<section anchor="key-distribution" title="Principle Key Distribution Mechanism">

<t>A PTP instance requests a key from the server referred to as the Key Establishment server, 
or (NTS-) KE server. <xref target="fig-key-distribution-sequence"/> describes the principle 
sequence which can be used for PTP multicast as well as PTP unicast operation.</t>


      <figure anchor="fig-key-distribution-sequence" title="NTS Key distribution sequence">
        <artwork><![CDATA[
PTP Instance 1                    NTS-KE-Server

 |                                    |
 |<======== Open TLS Channel ========>|
 |                                    |
 |                                    |
 |                                    |
 |                                    |
 |========= PTP Key Request =========>| )
 |                                    | ) NTS messages
 |                                    | ) for PTP
 |                                    | ) key exchange
 |<======== PTP Key Grant ============| )
 |                                    |
 |                                    |
 |                                    |
 |                                    |
 |<======== Close TLS Channel =======>|
 |                                    |
 |                                    o
 |                                        
 |                                        
 |                                        
 |                              PTP Instance 2/
 |                              PTP Network         
 |                                        
 |                                    |
 |                                    |
 |<---- Secured PTP Communication --->|
 |           using shared key         |
 |                                    |
 |                                    |
 V                                    V
 ]]>
        </artwork>
      </figure>



<t>The client connects to the KE server on the NTS TCP port (port number 4460). Then both parties 
perform a TLS handshake to establish a TLS 1.3 communication channel. No earlier TLS versions 
are allowed. The details of the TLS handshake are specified in IETF RFC 8446 <xref target="RFC8446"/>. </t>

<t>Implementations must conform to the rules stated in chapter 3 “TLS Profile for Network Time 
Security” of IETF RFC 8915 <xref target="RFC8915"/>:</t>



<t><list>
	 <t> <spanx style="emph">&quot;Network Time Security makes use of TLS for NTS key 
	     establishment.</spanx><vspace blankLines="1" /></t>
	 <t> <spanx style="emph">Since the NTS protocol is new as of this publication, no 
	     backward-compatibility concerns exist to justify using obsolete, insecure, or 
		 otherwise broken TLS features or versions.</spanx><vspace blankLines="1" /></t> 
	 <t> <spanx style="emph">Implementations MUST conform with RFC 7525 </spanx>
	     <xref target="RFC7525"/><spanx style="emph"> or with a later revision of BCP 195.
		 </spanx><vspace blankLines="1" /></t>
	 <t> <spanx style="emph">Implementations MUST NOT negotiate TLS versions earlier than 
	     1.3 </spanx><xref target="RFC8446"/><spanx style="emph"> and MAY refuse to negotiate 
		 any TLS version that has been superseded by a later supported version.</spanx>
		 <vspace blankLines="1" /></t>
	 <t> <spanx style="emph">Use of the Application-Layer Protocol Negotiation Extension 
	     </spanx><xref target="RFC7301"/><spanx style="emph"> is integral to NTS, and support 
		 for it is REQUIRED for interoperability ... &quot;</spanx></t>
</list></t>


            <t>The TLS handshake accomplishes the following:

            <list style="symbols">
			  <t>Negotiation of TLS version (only TLS 1.3 allowed), and</t>
              <t>negotiation of the cipher suite for the TLS session, and </t>
              <t>authentication of the TLS server (equivalent to the KE server) using a digital 
			     X.509 certificate,</t>
              <t>verification of the TLS client (PTP instance) using its digital X.509 certificate and</t>
              <t>the encryption of the subsequent information exchange between the TLS communication 
			     partners.</t>
            </list>
          </t>

<t>TLS therefore enables peer authentication by certificates and provides authenticity, message 
integrity and confidentiality of following data transmitted over the TLS channel.</t>

<t>TLS is a layer five protocol that runs on TCP over IP. Therefore, PTP implementations that 
support NTS-based key management need to support TCP and IP (at least on a separate management port).</t>

<t>Once the TLS session is established, the PTP instance will ask for a PTP key as well as the 
associated security parameters using the new NTS message PTP Key Request (see 
<xref target="key-request"/>). 
The NTS application of the KE server will respond with either a PTP Key 
Grant message (see <xref target="key-grant"/>), or a PTP Refusal message (see <xref target="refusal"/>). All messages 
are constructed from specific records as described in <xref target="nts-records"/>.</t>

<t>When the Key Request message was responded with a PTP Key Grant or a PTP Refusal the TLS 
session will be closed with a close notify TLS message from both parties, the PTP instance 
and the key server.</t>

<t>With the key and other information received, the PTP instance can take part in the secured 
PTP communication in the different modes of operation.</t>

<t>After the reception of the first set of security parameters the PTP instance can resume the 
TLS session by including a TLS session ID, allowing the PTP instance to skip the TLS version 
and algorithm negotiations. If resuming is used, a suitable lifetime for the TLS session key 
must be defined to not open the TLS connection for security threats.</t>

<t>As the TLS session provides authentication, but not authorization additional means has 
to be used for the latter (see <xref target="upfront-authorization"/>). </t>

<t>As mentioned above, the NTS key management for PTP supports two principle methods, the 
group-based approach and the ticket-based approach which are described in the following 
sections below.</t>


<section anchor="exchange-group-based" title="NTS Message Exchange for Group-based Approach">

<t>As described in <xref target="key-distribution"/>, a PTP instance wanting to join a secured 
PTP communication in the group-based modes contacts the KE server inside a secured TLS connection 
with a PTP Key Request message (see <xref target="key-request"/>) as shown in 
<xref target="fig-group-based"/>. The KE server answers with 
a PTP Key Grant message (see <xref target="key-grant"/>) with all the necessary data to join the group 
communication or with a PTP Refusal message (see <xref target="refusal"/>) if the PTP instance is not 
allowed to join the group. This procedure is necessary for all parties which are or will 
be members of that PTP group including the Grandmaster and other special participants, e.g. 
Transparent Clocks. As mentioned above, this not only applies to multicast mode but also 
to mixed multicast/unicast mode (former hybrid mode) where the explicit unicast communication 
uses the multicast group key received from the KE server. The group number for both modes 
is primarily generated by a concatenation of the PTP domain number and the PTP profile (sdoId), 
as described in <xref target="association-mode"/>.</t>

<t>Additionally, besides multicast and mixed multicast/unicast mode, a group of two (or few 
more) PTP instances can be configured, practically implementing a special group-based unicast 
communication mode, the group-of-2 (Go2) mode. </t>


      <figure anchor="fig-group-based" title="Message exchange for the group-based approach">
        <artwork><![CDATA[
Secured
PTP Network       PTP Instance          NTS-KE-Server

 |                      |                     |
 |                      |         TLS:        |
 |                  TLS |== PTP Key Request =>| Response contains:
 |              secured |                     | GroupID, security
 |        communication |         TLS:        | parameters, group
 |                      |<== PTP Key Grant ===| key, validity 
 |                      |                     | period etc.
 |                      |                     |
 |    Secured PTP:      |                     |
 |--- Announce -------->|  )                  |
 |                      |  )                  |
 |                      |  )                  |
 |    Secured PTP:      |  )                  |
 |-- Sync & Follow_Up ->|  )                  |
 |                      |  ) Secured          |
 |                      |  ) PTP messages     |
 |    Secured PTP:      |  ) using            |
 |<-- Delay_Req --------|  ) group key        |
 |                      |  )                  |
 |                      |  )                  |
 |    Secured PTP:      |  )                  |
 |--- Delay_Resp ------>|  )                  |
 |                      |  )                  |
 |                      |                     |
 V                      V                     V

Legend:        TLS:       Authenticated & encrypted
          =============>  TLS communication

           Secured PTP:   Group key-authenticated
          ------------->  PTP communication
 ]]>
        </artwork>
      </figure>

<t>This mode requires additional administration in advance defining groups-of-2 and supplying 
them with an additional attribute in addition to the group number mentioned for the other 
group-based modes – the subGroup attribute in the Association Mode record (see <xref target="association-mode"/>) of 
the PTP Key Request message. So, addressing for Go2 is achieved by use of the group number 
derived from domain number, sdoId and the additional attribute subGroup. Communication in 
that mode is performed using multicast addresses. If the latter is undesirable, unicast 
addresses can be used but the particular IP or MAC addresses of the communication partners 
need to be configured upfront, too.</t>

<t>In spite of its specific name, Go2 allows more than two participants, for example additional 
Transparent Clocks. All participants in that subgroup need to be configured respectively. 
(To enable the KE server to supply the subgroup members with the particular security data 
the respective certificates may reflect permission to take part in the subgroup. Else another 
authorization method is to be used.)</t>

<t>Having predefined the Go2s the key management for this mode of operation follows the same 
procedure (see <xref target="fig-group-based"/>) and uses the same NTS messages as the other group-based modes. 
Both participants, the Group-of-2 requester and the respective grantor need to have received 
their security parameters including key etc. before secure PTP communication can take place.</t>

<t>After the NTS key establishment messages for these group-based modes have been exchanged, 
the secured PTP communication can take place using the Security Association(s) communicated.</t>

<t>The key management for these modes works relatively simple and needs only the above mentioned 
three NTS messages: PTP Key Request, PTP Key Grant or PTP Refusal. The group number used for 
addressing is automatically derived from the configured attributes domain number and sdoID.</t>

<t>Additionally, besides multicast and hybrid mode, a (multicast) group of two PTP instances can 
be configured, practically implementing a special unicast communication.</t> 

<t>The key management for these modes works relatively simple and needs only the above mentioned 
three NTS messages: PTP Key Request, PTP Key Grant or PTP Refusal. The group number used for 
addressing is automatically derived from the configured attributes PTP domain number and sdoId. 
For Go2, the attribute subGroup is additionally required.</t>



</section>

<section  anchor="exchange-ticket-based" title="NTS Message Exchange for the Ticket-based Approach">

<t>In (native) PTP unicast mode using unicast message negotiation (<xref target="IEEE1588-2019"/>, 16.1) 
any potential instance (the grantor) which can be contacted by other PTP instances (the requesters) 
needs to register upfront with the KE server as depicted in <xref target="fig-ticket-based"/>.</t>


      <figure anchor="fig-ticket-based" title="Message exchange for ticket-based unicast mode">
        <artwork><![CDATA[
     PTP Requester         NTS-KE-Server            PTP Grantor
           
             |                    |                     |
             |                    |         TLS:        |Grantor
             |       KE generates |<= PTP Registration =|registers
             |         ticket key |       Request       |upfront
             |                    |                     |
             |                    |        TLS:         |gets
             |           KE sends |== PTP Registration >|ticket
             |         ticket key |       Success       |key to
             |                    |                     |decrypt
             :                    :                     :tickets
             :                    ;                     :
 PTP instance|     TLS:           |                     |
wants unicast|= PTP Key Request =>| KE generates        |
communication|                    | and sends           |
             |                    | unicast key         |
             |     TLS:           | & encrypted         |
             |<= PTP Key Grant ===| ticket              |
             |                    |                     |
             |                    |                     |
             |                    |                     |decrypts
      Unicast|                    |                     |ticket,
      request|  Secured PTP:      |                     |extracts
     contains|- Announce Request ---------------------->|containing
       ticket|                    |                     |unicast key
             |                    |                     |
             |  Secured PTP:      |                     |Grantor uses
             |< Grant ----------------------------------|unicast key
             |                    |                     |
             |                    |                     |
             V                    V                     V


Legend:        TLS:       Authenticated & encrypted
          =============>  TLS communication

           Secured PTP:   Unicast key-authenticated
          ------------->  PTP communication
 ]]>
        </artwork>
      </figure>



<t>(Note: As any PTP instance 
may request unicast messages from any other instance the terms requester and grantor as used in 
the standard suit better than talking about slave resp. master. In unicast PTP, the grantor is 
typically a PTP Port in the MASTER state, and the requester is typically a PTP Port in the SLAVE 
state, however all PTP Ports are allowed to grant and request unicast PTP message contracts 
regardless of which state they are in. A PTP port in MASTER state may be requester, a port in 
SLAVE state may be a grantor.)</t>

<t> This registration is performed via a PTP Registration Request message (see <xref target="registration-request"/>). The KE 
server answers with a PTP Registration Success message (see <xref target="registration-success"/>) or a PTP Refusal message 
(see <xref target="refusal"/>).</t>


<t>With the reception of the PTP Registration Success message the grantor holds a ticket key known 
only to the KE server and the registered grantor. With this ticket key it can decrypt  
cryptographic information contained in a so-called ticket which enables secure unicast 
communication.</t>

<t>As with the group-based approach, a PTP instance (the requester) wanting to start a secured 
PTP unicast communication with a specific grantor contacts the KE server sending a PTP Key 
Request message (see <xref target="key-request"/>) as shown in <xref target="fig-ticket-based"/> 
using the TLS-secured NTS Key Establishment protocol. The KE server answers with a 
PTP Key Grant message (see <xref target="key-grant"/>) 
with all the necessary data to begin the unicast communication with the desired partner or 
with a PTP Refusal message (see <xref target="refusal"/>) if unicast communication with that instance 
is unavailable.</t>

<t>The PTP Key Grant message includes a unicast key to secure the PTP message exchange with 
the desired grantor. In addition, it contains the above mentioned encrypted ticket which the 
requester transmits in a special Ticket TLV (see <xref target="new-ticket-tlv"/>) with the secured PTP message to 
the grantor. The grantor receiving the PTP message decrypts the received ticket with its 
ticket key and extracts the containing security parameters, for example the unicast key used 
by the requester to secure the PTP message and the requester’s identity. In that way the 
grantor can check the received message, identify the requester and can use the unicast key 
for further secure PTP communication with the requester until the unicast key expires.</t>

<t>After the NTS key establishment messages for the PTP unicast mode have been exchanged the 
secured PTP communication can take place using the Security Association(s) communicated. </t>

<t>If a grantor is no longer at disposal for unicast mode during the lifetime of registration 
and ticket key, it sends a TLS-secured PTP Registration Revoke message (see <xref target="registration-revoke"/>) 
to the KE server, so requesters no longer receive PTP Key Grant messages for this grantor.</t>

<t>This unicast mode is a bit more complex than the Group-of-2 approach and eventually uses 
all six new NTS messages. However, no subgroups have to be defined upfront. Addressing a grantor, 
the requesting instance simply may use the grantor’s IP, MAC address or PortIdentity attribute.</t>
</section>
</section>

<section anchor="general-topics" title="General Topics">

<t>This section describes more general topics like key update and key generation as well as discussion 
of the time information on the KE server, the use of certificates and topics concerning upfront 
configuration.</t>


<section anchor="key-update"  title="Key Update Process">

<t>All keys are equipped with parameters for a specific lifetime. Thereafter new key material has 
to be used. The value in the Lifetime record given by the KE server in the respective NTS messages is 
specified in seconds which denote the remaining time until the key expires and are decremented down 
to zero. So hard adjustments of the clock used have to be avoided. Therefore the use of a monotonic 
clock is recommended. Requests during the currently running lifetime will receive respectively 
adapted count 
values.</t>

<t>The receiving instances may concede a Grace Time in the range of, for example 5 - 10 seconds where 
an old key is still accepted to handle internal delays gracefully. The Grace Time may be defined in 
a PTP profile. Additionally, the KE server can optionally be configured to inform about a grace time 
value generally to be used.</t>

<t>New security parameters will be available after the Time until Update (TuU). The Time until Update 
given by the KE server is specified in seconds which are decremented down to zero. After that point 
in time until the end of the Lifetime of an associated key the PTP instances should connect to the 
KE server again, to receive new security parameters. The actual point in time, when a PTP instance 
asks for new data, should be selected randomly in the update period – the time after TuU was 
decremented to zero and before the Lifetime is counted down completely – to avoid peak load on the 
KE server. <xref target="fig-update-group-based"/> presents an example of the key update mechanism. 
A PTP instance sending a PTP 
Key Request to the KE server during the update period will receive the current security parameters 
(Current Parameters) as well as the security parameters of the following period (Next Parameters). 
As with the lifetime, requests during the currently running lifetime will receive respectively 
adapted count values for the current TuU.</t>

<t>Lifetime and Time until Update allow a cyclic rotation of security parameters during the running 
operation. This approach guarantees continuous secured PTP communication without interruption by 
key rotation. </t> 


      <figure anchor="fig-update-group-based" title="Example of the parameter rotation using Lifetime and
                                                      Time until Update in group-based mode">
        <artwork><![CDATA[
|12,389s (at time of key request)    0s|14,400s                   0s|
+--------------------------------------+------------------...-------+
|     Lifetime (curent parameters)     |  Lifetime (next parameters)|
+-----------------------------+--------+------------------...-------+
|         Time until Update   |  900s  |
+-----------------------------+<------>|
|11,489s (time of key req.) 0s| update |
                                period  
                              |________|
                                   |
                                   V
                   Request and receive new parameters
                        at a random point in time

Example:
--------
Lifetime (full):            14,400s = 4h
Time unitil Update (full):  13,500s -> updated period: 900s = 15 min
 ]]>
        </artwork>
      </figure>


<t>The key rotation mechanism described also applies for the ticket-based approach. As there are 
two keys, the ticket key and the unicast key, some details need to be explained 
(see <xref target="fig-update-ticket-based"/>). 
When the grantor registers with the KE server it receives the ticket key with the PTP Registration 
Success message together with the Lifetime and the respective Time until Update records. The 
lifetime parameters also apply to the ticket a requester would receive.</t>

<t>A requester wanting to communicate in unicast sends a PTP Key Request message with the particular 
parameters to the KE server. In the response it receives a specific unicast key with Lifetime and 
TuU as well as the encrypted ticket containing all the necessary security information for the grantor. 
The lifetime of the unicast key will end at the same point in time as the ticket key. Requests during 
the currently running lifetime of the ticket key will receive respectively adapted count values. The 
lifetime can be at most the remaining lifetime of the respective ticket key of the grantor.</t>



      <figure anchor="fig-update-ticket-based" title="Example of the parameter rotation using Lifetime and
                                                      Time until Update in ticket-based mode">

        <artwork><![CDATA[


Update process grantor:
-----------------------

(at time of registration success)
  |   
|14,400s                               0s |14,400s                0s|
+--------------------------------------------------------...--------+
|Lifetime (curr.ticket key)               |Lifetime (next ticket k.)|
+-------------------------+------+--------+--------------...--------+
|    Time until Update    | 300s |        :
+-------------------------+<---->|        :
|13,200s                0s|update|        :
  |                        period:        :
(at time of                      :        :      
 registration success)           :        :
                                 :        :
                                 :        : 
Update process requester:        :        :
-------------------------        :        :
                                 :        :
(at time of key grant)           :        :
      |                          :        :
    |12,389s                     :      0s|14,400s                0s|
    +-------------------------------------+-----------------...-----+
    |Lifetime (curent parameters)         | Lifetime (next params.) |
    +----------------------------+--------+-----------------...-----+
    |    Time until Update       |  900s  |
    +----------------------------+<------>|
    |11,489s                   0s| update |
      |                            period  
(at time of key grant)           |________|
                                      |
                                      V
                      Request and receive new parameters
                           at a random point in time

Example:
--------
Lifetime (full):            14,400s = 4h
Time unitil Update (full):
              - requester   13,500s -> updated period: 900s = 15 min
Time unitil Update (full):
              - grantor:    13,200s = ToU of requester - 300s
 ]]>
        </artwork>
      </figure>


<t>The TuU of the ticket key will end earlier than the TuU of associated unicast keys. The 
grantor should re-register in its update period beginning after the Time until Update of the 
ticket key was decremented to zero and ending when an associated unicast key TuU is counted 
down. As the grantor does not know how long its update period lasts it should re-register 
immediately after its TuU has ended. (A profile or a general configuration may fix the 
length of a grantors’ update period. Then the grantor could re-register at a random point 
in time during its update period. Because masters register asynchronously, their 
re-registration will also be asynchronous. So typically, no peak load for the KE server 
will be generated.) Its update period is a mere timing buffer for cases 
where re-registration will not work instantly. The re-registration should be completed before 
any requester can start a PTP Key Request for ticket-based unicast mode. This guarantees 
the availability of a new ticket. When re-registering in its update period the grantor will 
receive together with the ticket key, etc., Lifetime and Time until Update of the current 
period as well as the parameters of the following period - similar to multicast keys. (A 
registration during the TuU period will supply only current data, not parameters of the 
following period. A late re-registration after the end of the current Lifetime will start 
a new period with respective full lifetime und update parameters.)</t>

<t>A requester needs to ask for a new unicast key and ticket at the KE server during the 
update period for uninterrupted unicast communication possibility or else at any later 
point in time. During the update period it will receive the Current Parameters as well 
as the Next Parameters. Embedded in the respective data, it will receive the ticket for 
the grantor including the encrypted ticket. Each ticket carries the same security 
information as the respective Current Parameters or Next Parameters data structure.</t>

<t>If a grantor does not have re-registered (in time or at all) when corresponding requesters try 
to get unicast keys, they will receive a PTP Refusal message.</t>

<t>If a grantor has revoked his registration with a PTP Registration Revoke message, requesters will 
receive a PTP Refusal message when trying to update for a new unicast key. No immediate key revoke 
mechanism exists. The grantor should not grant respective unicast requests until the revoked key 
expires.</t>

</section>

<section anchor="key-generation" title="Key Generation">

<t>In all cases keys obtained by a secure random number generator shall be used. The length of 
the keys depends on the MAC algorithm (see also last subsection in <xref target="sa-sp-management"/>) 
respectively the AEAD algorithm utilized.</t>

</section>


<section anchor="time-ke-server" title="Time Information of the KE Server">

<t>As the KE server embeds time duration information in the respective messages, its local time should 
be sufficiently precise to a maximum a few seconds compared to the controlled PTP network(s). To 
avoid any dependencies, it should synchronize to a secure external time source, for example an 
NTS-secured NTP server. The time information is also necessary to check the lifetime of certificates 
used.</t>

</section>


<section anchor="certificates" title="Certificates">

<t>The authentication of the TLS communication parties is based on certificates issued by a trusted 
Certificate Authority (CA) that are utilized during the TLS handshake. In classical TLS applications 
only servers are required to have them. For the key management system described here,  the PTP nodes 
also need certificates to allow only authorized and trusted devices to get the group key and join 
a secure PTP network. (As TLS only authenticates the communication partners, authorization has to 
be managed by external means, see the topic “Authorization” in <xref target="upfront-authorization"/>.) 
The verification of a certificate always requires a loose time synchronicity, 
because they have a validity period. This, however, reveals the well-known start-up problem, since 
secure time transfer itself requires valid certificates. (See the discussion and proposals on this 
topic in IETF RFC 8915 <xref target="RFC8915"/>, chapter 8.5 “Initial Verification of Server certificates” which applies to 
client certificates in the PTP key management system, too.) </t>

<t>Furthermore, some kind of Public Key Infrastructure (PKI) is necessary, which may be conceivable via 
the Online Certificate Status Protocol (OCSP) as well as offline via root CA certificates.</t>

<t>The TLS communication parties must be equipped with a private key and a certificate in advance. The 
certificate contains a digital signature of the CA as well as the public key of the sender. The key 
pair is required to establish an authenticated and encrypted channel for the initial TLS phase. 
Distribution and update of the certificates can be done manually or automatically. However, it is 
important that they are issued by a trusted CA instance, which can be either local (private CA) or 
external (public CA).</t>

<t>For the certificates the standard for X.509 <xref target="ITU-T_X.509"/> certificates must be used. Additional data 
in the certificates like domain, sdoId and/or subgroup attributes may help in authorizing. In that 
case it should be noted that using the PTP device in another network then implies to have a new 
certificate, too. Working with certificates without authorization information would not have that 
disadvantage, but more configuring at the KE server would be necessary: which domain, sdoId and/or 
subgroup attributes belong to which certificate.</t>

<t>As TLS is used to secure the NTS Key Establishment protocol a comment on the security of TLS 
seems reasonable. A TLS 1.3 connection is considered secure today. However, note that a DoS (Denial 
of Service) attack on the key server can prevent new connections or parameter updates for secure 
PTP communication. A hijacked key management system is also critical, because it can completely 
disable the protection mechanism. A redundant implementation of the key server is therefore essential 
for a robust system. A further mitigation can be the limitation of the number of TLS requests of 
single PTP nodes to prevent flooding. But such measures are out of the scope of this document.</t>

</section>


<section anchor="upfront-configuration" title="Upfront Configuration">

<t>All PTP instances as well as the NTS-KE server need to be configured by the network administrator. 
This applies to several fields of parameters.</t>


<section anchor="upfront-security-parameters" title="Security Parameters">
<t>The cryptographic algorithm and associated parameters (the so-called Security Association(s) – SA) 
used for PTP keys are configured by network operators at the KE server. This includes the Security 
Policies, i.e. which PTP messages are to be secured. PTP instances that do not support the configured 
algorithms cannot operate with the security. Since most PTP Networks are managed by a single organization, 
configuring the cryptographic algorithm (MAC) for ICV calculation is practical. This prevents the 
need for the KE server and PTP instances to implement an NTS algorithm negotiation protocol. </t>

<t>For the ticket-based approach the AEAD algorithms need to be specified which the PTP grantors and 
the KE server support and negotiate during the registration process. Optionally, the MAC algorithm may 
be negotiated during a unicast PTP Key Request to allow faster or stronger algorithms, but a standard 
protocol supported by every instance should be defined. Eventually, suitable algorithms may be defined 
in a respective profile. </t>

</section>

<section anchor="upfront-key-lifetimes" title="Key Lifetimes">

<t>Supplementary to the above mentioned SAs the desired key rotation periods, i.e. the lifetimes of 
keys resp. all security parameters need to be configured at the NTS-KE server. This applies to the 
lifetime of a group key in the group-based approach as well as the lifetime of ticket key and unicast 
key in the ticket-based unicast approach (typically for every unicast pair in general or eventually 
specific for each requestor-grantor pair). In addition, the corresponding Time until Update parameters 
need to be defined which (together with the lifetime) specify the relevant update period. Any particular 
Lifetime and Time until Update are configured as time spans counted in seconds and start at the same 
point in time.</t>
</section>

<section anchor="upfront-certificates" title="Certificates">

<t>The network administrator has to supply each PTP instance and the KE server with their X.509 
certificates. The TLS communication parties must be equipped with a private key and a certificate 
containing the public key in advance (see <xref target="certificates"/>). </t>

</section>

<section anchor="upfront-authorization" title="Authorization">

<t>The certificates provide authentication of the communication partners. Normally, they do not 
contain authorization information. Authorization decides, which PTP instances are allowed to join 
a group (in any of the group-based modes) or may enter a unicast communication in the ticket-based 
approach and request the respective SA(s) and key. </t> 

<t>As mentioned, members of a group (multicast mode, mixed multicast/unicast mode) are identified 
by their domain and their sdoId. PTP Domain and sdoId may be attributes in the certificates of 
the potential group members supplying additional authorization. If not contained in the 
certificates extra authorization means are necessary. (See also the discussion on advantages 
and disadvantages on certificates containing additional authorization data in <xref target="certificates"/>.)</t>

<t>If the special Group-of-2 mode is used, the optional subGroup parameter (i.e. the subgroup 
number) needs to be specified at all members of respective Go2s, upfront. To enable the KE 
server to supply the subgroup members with the particular security data their respective 
certificates may reflect permission to take part in the subgroup. Else another authorization 
method is to be used.</t>

<t>In native unicast mode, any authenticated grantor that is member of the group used for multicast 
may request a registration for unicast communication at the KE server. If it is intended for 
unicast, this must be configured locally. If no group authorization is available (e.g. pure 
unicast operation) another authentication scheme is necessary. </t>

<t>In the same way, any requester (if configured for it locally) may request security data for a 
unicast connection with a specific grantor. Only authentication at the KE server using its 
certificate and membership in the group used for multicast is needed. If a unicast communication 
is not desired by the grantor, it should not grant a specific unicast request. Again, if no 
group authorization is available (e.g. pure unicast operation) another authentication scheme 
is necessary.</t>

<t>Authorization can be executed at least in some manual configuration. Probably the application 
of a standard access control system like Diameter, RADIUS or similar would be more appropriate. 
Also role-based access control (RBAC), attribute-based access control (ABAC) or more flexible 
tools like Open Policy Agent (OPA) could help administering larger systems. But details of the 
authorization of PTP instances lies out of scope of this document.</t>

</section>


<section anchor="upfront-tcs" title="Transparent Clocks">

<t>Transparent Clocks (TC) need to be supplied with respective certificates, too. For group-based 
modes they must be configured for the particular PTP domain and sdoId and eventually for the 
specific subgroup(s) when using Group-of-2. They need to request for the relevant group key(s) 
at the KE server to allow secure use of the correctionField in a PTP message and generation of 
a corrected ICV. If TCs are used in ticket-based unicast mode, they need to be authorized for 
the particular unicast path. </t>

<t>Authorization of TCs for the respective groups, subgroups and unicast connections is paramount. 
Otherwise the security can easily be broken with attackers pretending to be TCs in the path. 
Authorization of TCs is necessary too in unicast communication, even if the normal unicast 
partners need not be especially authorized.</t>

<t>Transparent clocks may notice that the communication runs secured. In the group-based 
approaches multicast mode and mixed multicast/unicast mode they construct the GroupID from domain 
and sdoId and request a group key from the KE server. Similarly, they can use the additional 
subgroup attribute in Go2 mode for a (group) key request. Afterwards they can check the ICV 
of incoming messages, fill in the correction field and generate a new ICV for outgoing messages. 
In ticket-based unicast mode a TC may notice a secured unicast request from a requester to the 
grantor and can request the unicast key from the KE server to make use of the correction field 
afterwards. As mentioned above upfront authentication and authorization of the particular TCs 
is paramount not to open the secured communication to attackers.</t>

</section>

<section anchor="upfront-start-up" title="Start-up considerations">
<t>At start-up of a single PTP instance or the complete PTP network some issues have to be considered.</t>
 
<t>At least loose time synchronization is necessary to allow for authentication using the certificates. 
See the discussion and proposals on this topic in IETF RFC 8915 <xref target="RFC8915"/>, chapter 8.5 “Initial Verification 
of Server certificates” which applies to client certificates in the PTP key management system, too.</t>

<t>Similarly to a key re-request during an update period, key requests should be started at a random 
point in time after start-up to avoid peak load on the NTS-KE server. Every grantor must register 
with the KE server before requesters can request a unicast key (and ticket).</t>

</section>

</section>
</section>

<section anchor="overview-nts-messages" title="Overview of NTS Messages and their Structure for Use with PTP">

<t><xref target="key-distribution"/> described the principle communication sequences for PTP Key Request, PTP Registration 
Request and corresponding response messages. All messages follow the “NTS Key Establishment Process” 
stated in the first part (until the description of Fig. 3 starts) of chapter 4 of IETF RFC 8915 <xref target="RFC8915"/>:</t>



<t><list>

      <t>
        <spanx style="emph">&quot;The NTS key establishment protocol is conducted via TCP port 4460.
        The two endpoints carry out a TLS handshake in conformance with
        Section 3, with the client offering (via an ALPN extension </spanx><xref target="RFC7301"/>)<spanx style="emph">, 
		and the server accepting,
        an application-layer protocol of &quot;ntske/1&quot;. Immediately
        following a successful handshake, the client SHALL send a single request
        as Application Data encapsulated in the TLS-protected channel. Then, the
        server SHALL send a single response. After sending their respective
        request and response, the client and server SHALL send TLS
        &quot;close_notify&quot; alerts in accordance with Section 6.1 of RFC 8446 </spanx><xref target="RFC8446"/>.
        <vspace blankLines="1" /></t>

      <t>
        <spanx style="emph">The client's request and the server's response each SHALL consist of a
        sequence of records formatted according to</spanx>
        <xref target="fig-ntske-record"/><spanx style="emph">. The request and a non-error response each
        SHALL include exactly one NTS Next Protocol Negotiation record. The
        sequence SHALL be terminated by a &quot;End of Message&quot; record. The
        requirement that all NTS-KE messages be terminated by an End of Message
        record makes them self-delimiting.</spanx>
        <vspace blankLines="1" /></t>
      <t>
        <spanx style="emph">Clients and servers MAY enforce length limits on requests and responses,
        however, servers MUST accept requests of at least 1024 octets and
        clients SHOULD accept responses of at least 65536 octets.</spanx>
        <vspace blankLines="1" /></t>

      <t>
        <spanx style="emph">The fields of an NTS-KE record are defined as follows:</spanx>
        <list>
          <t>
            <spanx style="emph">C (Critical Bit): Determines the disposition of unrecognized Record
            Types. Implementations which receive a record with an unrecognized
            Record Type MUST ignore the record if the Critical Bit is 0 and MUST
            treat it as an error if the Critical Bit is 1 (see Section 4.1.3).</spanx>
          <vspace blankLines="1" /></t>
          <t>
            <spanx style="emph">Record Type Number: A 15-bit integer in network byte order. The
            semantics of record types 0&ndash;7 are specified in this memo.
            Additional type numbers SHALL be tracked through the IANA Network
            Time Security Key Establishment Record Types registry.</spanx>
          <vspace blankLines="1" /></t>
          <t>
            <spanx style="emph">Body Length: The length of the Record Body field, in octets, as a
            16-bit integer in network byte order. Record bodies MAY have any
            representable length and need not be aligned to a word boundary.</spanx>
          <vspace blankLines="1" /></t>
          <t>
            <spanx style="emph">Record Body: The syntax and semantics of this field SHALL be
            determined by the Record Type.</spanx>
          <vspace blankLines="1" /></t>
        </list>
      </t>
      <t>
        <spanx style="emph">For clarity regarding bit-endianness: the Critical Bit is the
        most-significant bit of the first octet. In the C programming language,
        given a network buffer
        `unsigned char b[]` containing an NTS-KE record, the critical bit is
        `b[0] &gt;&gt; 7` while the record type is
        `((b[0] &amp; 0x7f) &lt;&lt; 8) + b[1]`.&quot;</spanx>
      </t>
</list></t>

      <figure anchor="fig-ntske-record" title="NTS-KE Record format">
        <artwork><![CDATA[
 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
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
|C|         Record Type         |          Body Length          |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
|                                                               |
:                                                               :
:                           Record Body                         :
|                                                               |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
]]>
        </artwork>
      </figure>
	

<t>Thus, all NTS messages consist of a sequence of records, each containing a Critical Bit C, the Record Type, 
the Body Length and the Record Body, see <xref target="fig-ntske-record"/>. More details on record structure as well as the specific 
records used here are given in <xref target="nts-messages-4-ptp"/> and respective subsections there. So-called container records (short: 
container) themselves comprise a set of records in the record body that serve a specific purpose, e.g. the 
Current Parameter container.</t>

<t>The records contained in a message may follow in arbitrary sequence (though nothing speaks against using the 
sequence given in the record descriptions), only the End of Message record has to be the last one in the 
sequence indicating the end of the current message. Container records do not include an End of Message record.</t>

<t>The NTS key management for PTP is based on six new NTS messages:</t>

<t> </t>
            <t><list style="symbols">
			  <t>PTP Key Request message (see <xref target="key-request"/>)</t>			  
			  <t>PTP Key Grant message (see <xref target="key-grant"/>)</t>
              <t>PTP Refusal message (see <xref target="refusal"/>)</t>
              <t>PTP Registration Request message (see <xref target="registration-request"/>)</t>
              <t>PTP Registration Grant message (see <xref target="registration-success"/>)</t>
              <t>PTP Registration Revoke message (see <xref target="registration-revoke"/>)</t>
            </list>
          </t>



<t>The following sections describe the principle structure of those new NTS messages for the PTP key 
management. More details especially on the records the messages are built of and their types, sizes, 
requirements and restrictions are given in <xref target="nts-records"/>.</t>


<section anchor="key-request" title="PTP Key Request Message">


      <figure anchor="fig-key-request" title="Structure of a PTP Key Request message">
        <artwork><![CDATA[
PTP Key Request 
+========================================+==========================+
| Record                                 | Exemplary body contents  |
+========================================+==========================+
| NTS Next Protocol Negotiation          | PTPv2.1                  |
+----------------------------------------+--------------------------+
| NTS Message Version                    | 1.0                      |
+----------------------------------------+--------------------------+
| NTS Message Type                       | PTP Key Grant            |
+----------------------------------------+--------------------------+
| Current Parameters                     | set of Records {...}     |
+----------------------------------------+--------------------------+
| MAC Algorithm Negotiation (optional)   | {CMAC || HMAC}           |
+----------------------------------------+--------------------------+
| Requesting PTP Identity (Unicast only) | data set {...}           |
+----------------------------------------+--------------------------+
| End of Message                         |                          |
+========================================+==========================+
]]>
        </artwork>
      </figure>
	  

<t><xref target="fig-key-request"/> shows the record structure of a PTP Key Request message. In the right column typical 
values are shown as examples. Detailed information on types, sizes etc. is given in <xref target="nts-records"/>. 
The message starts with the NTS Next Protocol Negotiation record which in this application always 
holds PTPv2.1. Currently, the following NTS Message Version record always contains 1.0. The next 
record characterizes the message type, in this case PTP Key Request. The Association Mode record 
describes the mode how the PTP instance wants to communicate: In the group-based approach the 
desired group number (plus eventually the subgroup attribute) is given. For ticket-based unicast 
communication the Association Mode contains the identification of the desired grantor, for example 
IPv4 and its IP address.</t>


<t>If there is an option to choose from additional MAC algorithms, then an optional record follows 
presenting the supported algorithms from which the KE server may choose. In ticket-based unicast 
mode, the Requesting PTP Identity record gives the data of the identification of the applying 
requester, for example IPv4 and its IP address.  The messages always end with an End of Message 
record.</t>

</section>


<section anchor="key-grant" title="PTP Key Grant Message">

<t><xref target="fig-key-grant"/> shows the record structure of a PTP Key Grant message. In the right column typical 
values are shown as examples. Detailed information on types, sizes etc. is given in <xref target="nts-records"/>. 
The message starts with the NTS Next Protocol Negotiation record which in this application always 
holds PTPv2.1. Currently, the following NTS Message Version record always contains 1.0. The next 
record characterizes the message type, in this case PTP Key Grant. </t>


      <figure anchor="fig-key-grant" title="Structure of a PTP Key Grant message">
        <artwork><![CDATA[
PTP Key Grant 
+=======================================+===========================+
| Record                                | Exemplary body contents   |
+=======================================+===========================+
| NTS Next Protocol Negotiation         | PTPv2.1                   |
+---------------------------------------+---------------------------+
| NTS Message Version                   | 1.0                       |
+---------------------------------------+---------------------------+
| NTS Message Type                      | PTP Key Grant             |
+---------------------------------------+---------------------------+
| Current Parameters                    | set of Records {...}      |
+---------------------------------------+---------------------------+
| Next Parameters                       | set of Records {...}      |
+---------------------------------------+---------------------------+
| End of Message                        |                           |
+=======================================+===========================+
]]>
        </artwork>
      </figure>
	  

<t>The following Current Parameters record is a container record containing in separate records 
all the security data needed to join and communicate in the secured PTP communication during the 
current validity period. <xref target="fig-current-container-grant"/> gives an example of data 
contained in that record. For more 
details on the records contained in the Current Parameters container see <xref target="current-parameters-container"/>.</t>


      <figure anchor="fig-current-container-grant" title="Exemplary contents of a Current Parameters 
	                                                      Container record of a PTP Key Grant message">
        <artwork><![CDATA[
Current Parameters Container record (PTP Key Grant)
+==============================+===================================+
| Record                       | Exemplary body contents           |
+==============================+========+==========================+
| Security Policies            |{(PTPmsg1||SPP:1)||(PTPmsg2||SPP:)}| 
+------------------------------+-----------------------------------+
| Security Association         | data set for SPP:1 {...}          |
+------------------------------+-----------------------------------+
| [Security Association]       | data set for SPP:2 {...}          |
+------------------------------+-----------------------------------+
| Lifetime                     | 1560s (=0h 26min)                 |
+------------------------------+-----------------------------------+
| Time until pdate             | 0s                                |
+------------------------------+-----------------------------------+
| Grace Period (optional)      | 10 seconds                        |
+------------------------------+-----------------------------------+
| Ticket Key ID (Unicast only) | 156                               |
+------------------------------+-----------------------------------+
| Ticket (Unicast only)        | data set {...}                    |
+==============================+===================================+
]]>
        </artwork>
      </figure>
	  


<t>If the request lies inside the update interval 
(i.e. TuU = 0, compare <xref target="fig-current-container-grant"/>), a Next 
Parameters Container record is appended giving all the security data needed in the upcoming 
validity period. Its structure follows the same composition as the Current Parameters record 
(in the ticked-based approach also including the Ticket Key ID record and the Ticket record). 
The messages always end with an End of Message record.</t>

</section>


<section anchor="refusal" title="PTP Refusal Message">

<t>The message starts with the NTS Next Protocol Negotiation record which in this application 
always holds PTPv2.1. Currently, the following NTS Message Version record always contains 1.0. 
The next record characterizes the message type, in this case PTP Refusal, see <xref target="fig-refusal"/>. The 
Error record contains information about the reason of refusal. The messages always end with an 
End of Message record.</t>


      <figure anchor="fig-refusal" title="Structure of a PTP Refusal message">
        <artwork><![CDATA[
PTP Refusal 
+================================+=================================+
| Record                         | Exemplary body contents         |
+================================+=================================+
| NTS Next Protocol Negotiation  | PTPv2.1                         |
+--------------------------------+---------------------------------+
| NTS Message Version            | 1.0                             |
+--------------------------------+---------------------------------+
| NTS Message Type               | PTP Refusal                     |
+--------------------------------+---------------------------------+
| Error                          | Association Port not registered |
+--------------------------------+---------------------------------+
| End of Message                 |                                 |
+================================+=================================+
]]>
        </artwork>
      </figure>
	  

</section>

 
<section anchor="registration-request" title="PTP Registration Request Message">

      <figure anchor="fig-registration-request" title="Structure of a PTP Registration Request message">
        <artwork><![CDATA[
PTP Registration Request 
+======================================+==========================+
| Record                               | Exemplary body contents  |
+======================================+==========================+
| NTS Next Protocol Negotiation        | PTPv2.1                  |
+--------------------------------------+--------------------------+
| NTS Message Version                  | 1.0                      |
+--------------------------------------+--------------------------+
| NTS Message Type                     | PTP Registration Request |
+--------------------------------------+--------------------------+
| Requesting PTP Identity              | data set {...}           |
+--------------------------------------+--------------------------+
| AEAD Algorithm Negotiation           | {AEAD_512 || AEAD_256}   |
+--------------------------------------+--------------------------+
| MAC Algorithm Negotiation (optional) | {CMAC || HMAC}           |
+--------------------------------------+--------------------------+
| End of Message                       |                          |
+======================================+==========================+
]]>
        </artwork>
      </figure>
	  
<t>The message starts with the NTS Next Protocol Negotiation record which in this application 
always holds PTPv2.1. Currently, the following NTS Message Version record always contains 1.0. 
The next record characterizes the message type, in this case PTP Registration Request, see 
<xref target="fig-registration-request"/>.</t>

<t>The Requesting PTP Identity record gives the addresses of the grantor requesting registration 
whereas the following AEAD Algorithm Negotiation record indicates which algorithms for encryption 
of the ticket the requester supports.</t>

<t>If there is an option to choose from additional MAC algorithms, then an optional record 
follows presenting all the grantor’s supported algorithms from which the KE server may choose. 
The messages always end with an End of Message record. </t>

</section>


<section anchor="registration-success" title="PTP Registration Success Message">

      <figure anchor="fig-registration-success" title="Structure of a PTP Registration Success message">
        <artwork><![CDATA[
PTP Registration Success 
+====================================+============================+
| Record                             | Exemplary body contents    |
+====================================+============================+
| NTS Next Protocol Negotiation      | PTPv2.1                    |
+------------------------------------+----------------------------+
| NTS Message Version                | 1.0                        |
+------------------------------------+----------------------------+
| NTS Message Type                   | PTP Registration Success   |
+------------------------------------+----------------------------+
| Current Parameters                 | set of Records {...}       |
+------------------------------------+----------------------------+
| Next Parameters                    | set of Records {...}       |
+------------------------------------+----------------------------+
| End of Message                     |                            |
+====================================+============================+
]]>
        </artwork>
      </figure>
	  

<t>The message starts with the NTS Next Protocol Negotiation record which in this application 
always holds PTPv2.1. Currently, the following NTS Message Version record always contains 1.0. 
The next record characterizes the message type, in this case PTP Registration Success, see 
<xref target="fig-registration-success"/>.</t>

<t>The following Current Parameters record is a container record containing in separate records 
all the security data needed to join and communicate in the secured PTP communication during 
the current validity period. <xref target="fig-current-container-success"/> gives an example 
of data contained in that container 
as a response to PTP Registration Request. For more details on the records contained in the 
Current Parameters container see <xref target="current-parameters-container"/>.  </t>

      <figure anchor="fig-current-container-success" title="Exemplary contents of a Current 
	                                                        Parameters Container record of a 
															PTP Registration Success message
">
        <artwork><![CDATA[
Current Parameters Container record (PTP Registration Success)
+==================================+========+=====================+
| Record                           | Exemplary body contents      |
+==================================+==============================+
| AEAD Algorithm Negotiation       | AEAD_CMAC_512                |
+----------------------------------+------------------------------+
| Lifetime                         | 2,460s (=0h 41min)           |
+----------------------------------+------------------------------+
| Time until pdate                 | 0s                           |
+----------------------------------+------------------------------+
| Ticket Key                       | {binary data}                |
+----------------------------------+------------------------------+
| Ticket Key ID                    | 278                          |
+----------------------------------+------------------------------+
| Grace Period (optional)          | 10 seconds                   |
+==================================+========+=====================+
]]>
        </artwork>
      </figure>
	  

<t>If the registration request lies inside the update interval a Next Parameters Container 
record is appended giving all the security data needed in the upcoming validity period. Its 
structure follows the same composition as the Current Parameters record. The messages always 
end with an End of Message record.</t>

</section>



<section anchor="registration-revoke" title="PTP Registration Revoke Message">


      <figure anchor="fig-registration-revoke" title="Structure of a PTP Registration Revoke message">
	  
        <artwork><![CDATA[
PTP Registration Revoke 
+===================================+=============================+
| Record                            | Exemplary body contents     |
+===================================+=============================+
| NTS Next Protocol Negotiation     | PTPv2.1                     |
+-----------------------------------+-----------------------------+
| NTS Message Version               | 1.0                         |
+-----------------------------------+-----------------------------+
| NTS Message Type                  | PTP Registration Revoke     |
+-----------------------------------+-----------------------------+
| End of Message                    |                             |
+===================================+=============================+
]]>
        </artwork>
      </figure>


<t>The message starts with the NTS Next Protocol Negotiation record which in this application 
always holds PTPv2.1. Currently, the following NTS Message Version record always contains 1.0. 
The next record characterizes the message type, in this case PTP Registration Revoke, see 
<xref target="fig-registration-revoke"/>. The messages always end with an End of Message record.</t>

</section>
</section>
</section>



<section anchor="nts-messages-4-ptp" title="NTS Messages for PTP">

<t>This chapter covers the structure of the NTS messages and the details of the respective 
payload. The individual parameters are transmitted by NTS records, which are described in 
more detail in <xref target="nts-records"/>. In addition to the NTS records defined for NTP in IETF RFC8915, 
further records are required, which are listed in <xref target="tbl_nts_ke_record_registry"/> below and begin with Record Type 1024 
(compare IETF RFC 8915 <xref target="RFC8915"/>, 7.6.  Network Time Security Key Establishment Record Types Registry).</t>


	<texttable anchor="tbl_nts_ke_record_registry" title="NTS Key Establishment record types registry">
        <!--   <preamble><spanx style="strong"></spanx></preamble>   -->

		<!-- table header:  -->
        <ttcol align="left">NTS Record Types</ttcol>
        <ttcol align="left">Description</ttcol>
        <ttcol align="left">Reference</ttcol>

		<!-- columns:  --> 
		<!-- 1st row:  -->
          <c>0</c>
          <c>End of Message</c>
		  <c><xref target="RFC8915"/>, section 4.1.1, this document, <xref target="end-of-message"/> </c>
		<!-- 2nd row:  -->
          <c>1</c>
          <c>NTS Next Protocol Negotiation</c>
		  <c><xref target="RFC8915"/>, section 4.1.2, this document, <xref target="nts-next-protocol-nego"/> </c>
		<!-- 3rd row:  -->
          <c>2</c>
          <c>Error</c>
		  <c><xref target="RFC8915"/>, section 4.1.3, this document, <xref target="error"/> </c>
		<!-- 4th row:  -->
          <c>3</c>
          <c>Warning</c>
		  <c><xref target="RFC8915"/>, section 4.1.4</c>
		<!-- 5th row:  -->
          <c>4</c>
          <c>AEAD Algorithm Negotiation</c>
		  <c><xref target="RFC8915"/>, section 4.1.5, this document, <xref target="aead-negotiation"/> </c>
		<!-- 6th row:  -->
          <c>5</c>
          <c>New Cookie for NTPv4 (not needed for PTP)</c>
		  <c><xref target="RFC8915"/>, section 4.1.6</c>
		<!-- 7th row:  -->
          <c>6</c>
          <c>NTPv4 Server Negotiation (not needed for PTP)</c>
		  <c><xref target="RFC8915"/>, section 4.1.7</c>
		<!-- 8th row:  -->
          <c>7</c>
          <c>NTPv4 Port Negotiation (not needed for PTP)</c>
		  <c><xref target="RFC8915"/>, section 4.1.8</c>
		<!-- 9th row:  -->
          <c>8 - 1023</c>
          <c>Reserved for NTP</c>
		  <c></c>
		<!-- 10th row:  EMPTY-->
          <c></c>
          <c></c>
		  <c></c>
		<!-- 11th row:  -->
          <c>1024</c>
          <c>Association Mode</c>
		  <c>This document, <xref target="association-mode"/> </c>
		<!-- 12th row:  -->
          <c>1025</c>
          <c>Current Parameters Container</c>
		  <c>This document, <xref target="current-parameters-container"/> </c>
		<!-- 13th row:  -->
          <c>1026</c>
          <c>Grace Period</c>
		  <c>This document, <xref target="grace-period"/> </c>
		<!-- 14th row:  -->
          <c>1027</c>
          <c>Lifetime</c>
		  <c>This document, <xref target="lifetime"/> </c>
		<!-- 15th row:  -->
          <c>1028</c>
          <c>MAC Algorithm Negotiation</c>
		  <c>This document, <xref target="mac-algo-negotiation"/> </c>
		<!-- 16th row:  -->
          <c>1029</c>
          <c>Next Parameters Container</c>
		  <c>This document, <xref target="next-parameters-container"/> </c>
		<!-- 17th row:  -->
          <c>1030</c>
          <c>NTS Message Type</c>
		  <c>This document, <xref target="nts-message-type"/> </c>
		<!-- 18th row:  -->
          <c>1031</c>
          <c>NTS Message Version</c>
		  <c>This document, <xref target="nts-message-version"/> </c>
		<!-- 19th row:  -->
          <c>1032</c>
          <c>Requesting PTP Identity</c>
		  <c>This document, <xref target="requesting-ptp-identity"/> </c>
		<!-- 20th row:  -->
          <c>1033</c>
          <c>Security Association</c>
		  <c>This document, <xref target="security-association"/> </c>
		<!-- 20th row:  -->
          <c>1034</c>
          <c>Security Policies</c>
		  <c>This document, <xref target="security-policies"/> </c>
		<!-- 20th row:  -->
          <c>1035</c>
          <c>Ticket</c>
		  <c>This document, <xref target="ticket"/> </c>
		<!-- 20th row:  -->
          <c>1036</c>
          <c>Ticket Container</c>
		  <c>This document, <xref target="ticket-container"/> </c>
		<!-- 20th row:  -->
          <c>1037</c>
          <c>Ticket Key</c>
		  <c>This document, <xref target="ticket-key"/> </c>
		<!-- 20th row:  -->
          <c>1038</c>
          <c>Ticket Key ID</c>
		  <c>This document, <xref target="ticket-key-id"/> </c>
		<!-- 20th row:  -->
          <c>1039</c>
          <c>Time until Update</c>
		  <c>This document, <xref target="time-until-update"/> </c>
		<!-- 20th row:  EMPTY  -->
          <c></c>
          <c></c>
		  <c></c>
		<!-- 20th row:  -->
          <c>1040 - 16383</c>
          <c>Unassigned</c>
		  <c></c>
		<!-- 20th row:  -->
          <c>16384 - 32767</c>
          <c>Reserved for Private or Experimental Use</c>
		  <c><xref target="RFC8915"/> </c>

        <!-- <postamble></postamble>   -->
    </texttable>




<section anchor="nts-message-types" title="NTS Message Types">

<t>This section repeats the composition of the specific NTS messages for the PTP key 
management in overview form. The specification of the respective records from which the 
messages are constructed follows in <xref target="nts-records"/>. The reference column in the tables 
refer to the specific subsections.</t>

<t>The NTS messages must contain the records given for the particular message though not 
necessarily in the same sequence indicated. Only the End of Message record is mandatory 
the final record.</t>

	<texttable anchor="tbl_ptp_key_request" title="Record structure of the PTP Key Request message">
        <preamble><spanx style="strong">PTP Key Request</spanx></preamble>

		<!-- table header:  -->
        <ttcol align="left">NTS Record Name</ttcol>
        <ttcol align="left">Comm. Type*</ttcol>
        <ttcol align="center">Use</ttcol>
        <ttcol align="left">Reference</ttcol>

		<!-- columns:  --> 
		<!-- 1st row:  -->
          <c>NTS Next Protocol Negotiation</c>
          <c>Multicast / Unicast</c>
          <c>mand.</c>
		  <c>This document, <xref target="nts-next-protocol-nego"/> </c>
		<!-- 2nd row:  -->
          <c>NTS Message Version</c>
          <c>Multicast / Unicast</c>
          <c>mand.</c>
		  <c>This document, <xref target="nts-message-version"/> </c>
		<!-- 3rd row:  -->
          <c>NTS Message Type</c>
          <c>Multicast / Unicast</c>
          <c>mand.</c>
		  <c>This document, <xref target="nts-message-type"/> </c>
		<!-- 4th row:  -->
          <c>Association Mode</c>
          <c>Multicast / Unicast</c>
          <c>mand.</c>
		  <c>This document, <xref target="association-mode"/> </c>
		<!-- 5th row:  -->
          <c>MAC Algorithm Negotiation</c>
          <c>Unicast</c>
          <c>opt.</c>
		  <c>This document, <xref target="mac-algo-negotiation"/> </c>
		<!-- 6th row:  -->
          <c>Requesting PTP Identity</c>
          <c>Unicast</c>
          <c>mand.</c>
		  <c>This document, <xref target="requesting-ptp-identity"/> </c>
		<!-- 7th row:  -->
          <c>End of Message</c>
          <c>Multicast / Unicast</c>
          <c>mand.</c>
		  <c>This document, <xref target="end-of-message"/> </c>

        <postamble>* The Communication Type column refers to the intended use of the particular record for the respective PTP communication mode.</postamble>   
    </texttable>


	<texttable anchor="tbl_ptp_key_grant" title="Record structure of the PTP Key Grant message">
        <preamble><spanx style="strong">PTP Key Grant</spanx></preamble>

		<!-- table header:  -->
        <ttcol align="left">NTS Record Name</ttcol>
        <ttcol align="left">Comm. Type</ttcol>
        <ttcol align="center">Use</ttcol>
        <ttcol align="left">Reference</ttcol>

		<!-- columns:  --> 
		<!-- 1st row:  -->
          <c>NTS Next Protocol Negotiation</c>
          <c>Multicast / Unicast</c>
          <c>mand.</c>
		  <c>This document, <xref target="nts-next-protocol-nego"/> </c>
		<!-- 2nd row:  -->
          <c>NTS Message Version</c>
          <c>Multicast / Unicast</c>
          <c>mand.</c>
		  <c>This document, <xref target="nts-message-version"/> </c>
		<!-- 3rd row:  -->
          <c>NTS Message Type</c>
          <c>Multicast / Unicast</c>
          <c>mand.</c>
		  <c>This document, <xref target="nts-message-type"/> </c>
		<!-- 4th row:  -->
          <c>Current Parameters Container</c>
          <c>Multicast / Unicast</c>
          <c>mand.</c>
		  <c>This document, <xref target="current-parameters-container"/> </c>
		<!-- 5th row:  -->
          <c>Next Parameters Container</c>
          <c>Multicast / Unicast</c>
          <c>opt. (conditional)</c>
		  <c>This document, <xref target="next-parameters-container"/> </c>
		<!-- 6th row:  -->
          <c>End of Message</c>
          <c>Multicast / Unicast</c>
          <c>mand.</c>
		  <c>This document, <xref target="end-of-message"/> </c>

<!--        <postamble></postamble>   -->
    </texttable>

<t>The structure of the respective container records (Current Parameters Container and Next 
   Parameters Container) used in the PTP Key Grant message is given below:</t>


	<texttable anchor="tbl_container" title="Record structure of the container records">
        <!--   <preamble><spanx style="strong"> </spanx></preamble>   -->

		<!-- table header:  -->
        <ttcol align="left">NTS Record Name</ttcol>
        <ttcol align="left">Comm. Type</ttcol>
        <ttcol align="center">Use</ttcol>
        <ttcol align="left">Reference</ttcol>

		<!-- columns:  --> 
		<!-- 1st row:  -->
          <c>Security Policies</c>
          <c>Multicast / Unicast</c>
          <c>mand.</c>
		  <c>This document, <xref target="security-policies"/> </c>
		<!-- 2nd row:  -->
          <c>Security Association (one or more)</c>
          <c>Multicast / Unicast</c>
          <c>mand.</c>
		  <c>This document, <xref target="security-association"/> </c>
		<!-- 3rd row:  -->
          <c>Lifetime</c>
          <c>Multicast / Unicast</c>
          <c>mand.</c>
		  <c>This document, <xref target="lifetime"/> </c>
		<!-- 4th row:  -->
          <c>Time until Update</c>
          <c>Multicast / Unicast</c>
          <c>mand.</c>
		  <c>This document, <xref target="time-until-update"/> </c>
		<!-- 5th row:  -->
          <c>Grace Period</c>
          <c>Multicast / Unicast</c>
          <c>opt.</c>
		  <c>This document, <xref target="grace-period"/> </c>
		<!-- 6th row:  -->
          <c>Ticket Key ID</c>
          <c>Unicast</c>
          <c>mand.</c>
		  <c>This document, <xref target="ticket-key-id"/> </c>
		<!-- 7th row:  -->
          <c>Ticket</c>
          <c>Unicast</c>
          <c>mand.</c>
		  <c>This document, <xref target="ticket"/> </c>

<!--        <postamble></postamble>   -->
    </texttable>


<t>The encrypted Ticket Container within the Ticket record also includes a set of records listed below:</t>

	<texttable anchor="tbl_encrypted_ticket_container" title="Record structure of the enctypted Ticket container record">
        <!--   <preamble><spanx style="strong"> </spanx></preamble>   -->

		<!-- table header:  -->
        <ttcol align="left">NTS Record Name</ttcol>
        <ttcol align="left">Comm. Type</ttcol>
        <ttcol align="center">Use</ttcol>
        <ttcol align="left">Reference</ttcol>

		<!-- columns:  --> 
		<!-- 1st row:  -->
          <c>Requesting PTP Identity</c>
          <c>Unicast</c>
          <c>mand.</c>
		  <c>This document, <xref target="requesting-ptp-identity"/> </c>
		<!-- 2nd row:  -->
          <c>Security Policies</c>
          <c>Multicast / Unicast</c>
          <c>mand.</c>
		  <c>This document, <xref target="security-policies"/> </c>
		<!-- 3rd row:  -->
          <c>Security Association (one or more)</c>
          <c>Multicast / Unicast</c>
          <c>mand.</c>
		  <c>This document, <xref target="security-association"/> </c>
		<!-- 4th row:  -->
          <c>Lifetime</c>
          <c>Multicast / Unicast</c>
          <c>mand.</c>
		  <c>This document, <xref target="lifetime"/> </c>
		<!-- 5th row:  -->
          <c>Time until Update</c>
          <c>Multicast / Unicast</c>
          <c>mand.</c>
		  <c>This document, <xref target="time-until-update"/> </c>
		<!-- 6th row:  -->
          <c>Grace Period</c>
          <c>Multicast / Unicast</c>
          <c>opt.</c>
		  <c>This document, <xref target="grace-period"/> </c>

<!--        <postamble></postamble>   -->
    </texttable>


	<texttable anchor="tbl_ptp_refusal" title="Record structure of the PTP Refusal message">
        <preamble><spanx style="strong">PTP Refusal</spanx></preamble>

		<!-- table header:  -->
        <ttcol align="left">NTS Record Name</ttcol>
        <ttcol align="left">Comm. Type</ttcol>
        <ttcol align="center">Use</ttcol>
        <ttcol align="left">Reference</ttcol>

		<!-- columns:  --> 
		<!-- 1st row:  -->
          <c>NTS Next Protocol Negotiation</c>
          <c>Multicast / Unicast</c>
          <c>mand.</c>
		  <c>This document, <xref target="nts-next-protocol-nego"/> </c>
		<!-- 2nd row:  -->
          <c>NTS Message Version</c>
          <c>Multicast / Unicast</c>
          <c>mand.</c>
		  <c>This document, <xref target="nts-message-version"/> </c>
		<!-- 3rd row:  -->
          <c>NTS Message Type</c>
          <c>Multicast / Unicast</c>
          <c>mand.</c>
		  <c>This document, <xref target="nts-message-type"/> </c>
		<!-- 4th row:  -->
          <c>Error</c>
          <c>Multicast / Unicast</c>
          <c>mand.</c>
		  <c>This document, <xref target="error"/> </c>
		<!-- 5th row:  -->
          <c>End of Message</c>
          <c>Multicast / Unicast</c>
          <c>mand.</c>
		  <c>This document, <xref target="end-of-message"/> </c>

<!--        <postamble></postamble>   -->
    </texttable>


	<texttable anchor="tbl_ptp_registration_request" title="Record structure of the PTP Registration Request message">
        <preamble><spanx style="strong">PTP Registration Request</spanx></preamble>

		<!-- table header:  -->
        <ttcol align="left">NTS Record Name</ttcol>
        <ttcol align="left">Comm. Type</ttcol>
        <ttcol align="center">Use</ttcol>
        <ttcol align="left">Reference</ttcol>

		<!-- columns:  --> 
		<!-- 1st row:  -->
          <c>NTS Next Protocol Negotiation</c>
          <c>Multicast / Unicast</c>
          <c>mand.</c>
		  <c>This document, <xref target="nts-next-protocol-nego"/> </c>
		<!-- 2nd row:  -->
          <c>NTS Message Version</c>
          <c>Multicast / Unicast</c>
          <c>mand.</c>
		  <c>This document, <xref target="nts-message-version"/> </c>
		<!-- 3rd row:  -->
          <c>NTS Message Type</c>
          <c>Multicast / Unicast</c>
          <c>mand.</c>
		  <c>This document, <xref target="nts-message-type"/> </c>
		<!-- 4th row:  -->
          <c>Requesting PTP Identity</c>
          <c>Unicast</c>
          <c>mand.</c>
		  <c>This document, <xref target="requesting-ptp-identity"/> </c>
		<!-- 5th row:  -->
          <c>AEAD Algorithm Negotiation</c>
          <c>Unicast</c>
          <c>mand.</c>
		  <c>This document, <xref target="aead-negotiation"/> </c>
		<!-- 5th row:  -->
          <c>MAC Algorithm Negotiation</c>
          <c>Unicast</c>
          <c>opt.</c>
		  <c>This document, <xref target="mac-algo-negotiation"/> </c>
		<!-- 5th row:  -->
          <c>End of Message</c>
          <c>Multicast / Unicast</c>
          <c>mand.</c>
		  <c>This document, <xref target="end-of-message"/> </c>

<!--        <postamble></postamble>   -->
    </texttable>



	<texttable anchor="tbl_ptp_registration_success" title="Record structure of the PTP Registration Success message">
        <preamble><spanx style="strong">PTP Registration Success</spanx></preamble>

		<!-- table header:  -->
        <ttcol align="left">NTS Record Name</ttcol>
        <ttcol align="left">Comm. Type</ttcol>
        <ttcol align="center">Use</ttcol>
        <ttcol align="left">Reference</ttcol>

		<!-- columns:  --> 
		<!-- 1st row:  -->
          <c>NTS Next Protocol Negotiation</c>
          <c>Multicast / Unicast</c>
          <c>mand.</c>
		  <c>This document, <xref target="nts-next-protocol-nego"/> </c>
		<!-- 2nd row:  -->
          <c>NTS Message Version</c>
          <c>Multicast / Unicast</c>
          <c>mand.</c>
		  <c>This document, <xref target="nts-message-version"/> </c>
		<!-- 3rd row:  -->
          <c>NTS Message Type</c>
          <c>Multicast / Unicast</c>
          <c>mand.</c>
		  <c>This document, <xref target="nts-message-type"/> </c>
		<!-- 4th row:  -->
          <c>Current Parameters Container</c>
          <c>Multicast / Unicast</c>
          <c>mand.</c>
		  <c>This document, <xref target="current-parameters-container"/> </c>
		<!-- 5th row:  -->
          <c>Next Parameters Container</c>
          <c>Multicast / Unicast</c>
          <c>mand. (conditional)</c>
		  <c>This document, <xref target="next-parameters-container"/> </c>
		<!-- 6th row:  -->
          <c>End of Message</c>
          <c>Multicast / Unicast</c>
          <c>mand.</c>
		  <c>This document, <xref target="end-of-message"/> </c>

<!--        <postamble></postamble>   -->
    </texttable>


<t>The structure of the respective container records (Current Parameters Container and Next Parameters 
   Container) used in the PTP Registration Success message is given below:</t>
   

	<texttable anchor="tbl_container_in_success" title="Record structure of the container records in th PTP Regsitration Success message">
        <!--   <preamble><spanx style="strong"> </spanx></preamble>   -->

		<!-- table header:  -->
        <ttcol align="left">NTS Record Name</ttcol>
        <ttcol align="left">Comm. Type</ttcol>
        <ttcol align="center">Use</ttcol>
        <ttcol align="left">Reference</ttcol>

		<!-- columns:  --> 
		<!-- 1st row:  -->
          <c>AEAD Algorithm Negotiation</c>
          <c>Unicast</c>
          <c>mand.</c>
		  <c>This document, <xref target="aead-negotiation"/> </c>
		<!-- 2nd row:  -->
          <c>Lifetime</c>
          <c>Multicast / Unicast</c>
          <c>mand.</c>
		  <c>This document, <xref target="lifetime"/> </c>
		<!-- 3rd row:  -->
          <c>Time until Update</c>
          <c>Multicast / Unicast</c>
          <c>mand.</c>
		  <c>This document, <xref target="time-until-update"/> </c>
		<!-- 4th row:  -->
          <c>Grace Period</c>
          <c>Multicast / Unicast</c>
          <c>opt.</c>
		  <c>This document, <xref target="grace-period"/> </c>
		<!-- 5th row:  -->
          <c>Ticket Key ID</c>
          <c>Unicast</c>
          <c>mand.</c>
		  <c>This document, <xref target="ticket-key-id"/> </c>
		<!-- 6th row:  -->
          <c>Ticket</c>
          <c>Unicast</c>
          <c>mand.</c>
		  <c>This document, <xref target="ticket"/> </c>

<!--        <postamble></postamble>   -->
    </texttable>


	<texttable anchor="tbl_ptp_registration_revoke" title="Record structure of the PTP Registration Revoke message">
        <preamble><spanx style="strong">PTP Registration Revoke</spanx></preamble>

		<!-- table header:  -->
        <ttcol align="left">NTS Record Name</ttcol>
        <ttcol align="left">Comm. Type</ttcol>
        <ttcol align="center">Use</ttcol>
        <ttcol align="left">Reference</ttcol>

		<!-- columns:  --> 
		<!-- 1st row:  -->
          <c>NTS Next Protocol Negotiation</c>
          <c>Multicast / Unicast</c>
          <c>mand.</c>
		  <c>This document, <xref target="nts-next-protocol-nego"/> </c>
		<!-- 2nd row:  -->
          <c>NTS Message Version</c>
          <c>Multicast / Unicast</c>
          <c>mand.</c>
		  <c>This document, <xref target="nts-message-version"/> </c>
		<!-- 3rd row:  -->
          <c>NTS Message Type</c>
          <c>Multicast / Unicast</c>
          <c>mand.</c>
		  <c>This document, <xref target="nts-message-type"/> </c>
		<!-- 4th row:  -->
          <c>End of Message</c>
          <c>Multicast / Unicast</c>
          <c>mand.</c>
		  <c>This document, <xref target="end-of-message"/> </c>

<!--        <postamble></postamble>   -->
    </texttable>

</section>




<section anchor="nts-records" title="NTS Records">


<t>The following subsections describe the specific NTS records used to construct the NTS 
messages for the PTP key management system in detail. They appear in alphabetic sequence 
of their individual names. See <xref target="nts-message-types"/> for the application of the records in the 
respective messages.</t>

<t>Note: For easier editing of the content, most of the descriptions in the following 
subsections are written as bullet points.</t>

<t>Global rules:</t>
		<t><list style="symbols">
			  <t>The NTS Next Protocol Negotiation record MUST offer (at least) 
			     Protocol ID 1 for “PTPv2.1” (see <xref target="nts-next-protocol-nego"/>).</t>
              <t>The NTS Message Version record MUST be v1.0.</t>
              <t>Note: Records must be used only in the mentioned messages. Not elsewhere.</t>
              <t>The notational conventions of <xref target="notational-conventions"/> MUST be followed.</t>
            </list>
        </t>



<section anchor="aead-negotiation" title="AEAD Algorithm Negotiation">

	<t>This record is required in unicast mode and enables the negotiation of the AEAD 
	algorithm needed to encrypt and decrypt the ticket. The negotiation takes place between 
	the PTP grantor and the NTS-KE server by using the NTS registration messages. The 
	structure and properties follow the record defined in IETF RFC 8915 <xref target="RFC8915"/>, 4.1.5.</t>

	<t>Content and conditions:</t>
	<t><list style="symbols">
	   <t>The record has a Record Type number of 4 and the Critical Bit MAY be set.</t>
	   <t>The record body contains a sequence of 16-bit unsigned integers in network byte order:<vspace blankLines="1" />
	      <spanx style="strong">Supported AEAD Algorithms = {AEAD 1 || AEAD 2 || …}</spanx></t>
	</list></t>

	<!-- <t>Supported AEAD Algorithms = {AEAD 1 || AEAD 2 || …}</t>   -->

	<t><list style="symbols">
		<t>Each integer represents a numeric identifier of an AEAD algorithm registered by the IANA.
		   (https://www.iana.org/assignments/aead-parameters/aead-parameters.xhtml)</t> 
		<t>Duplicate identifiers SHOULD NOT be included.</t>
		<t>Grantor and NTS-KE server MUST support at least the AEAD_AES_SIV_CMAC_256 algorithm.</t>
		<t>A list of recommended AEAD algorithms is shown in the following table.</t> 
	    <t>Other AEAD algorithms MAY also be used.</t>
	</list></t>
	
	<texttable anchor="tbl_aead" title="AEAD algorithms">
    <!--      <preamble>Tables use ttcol to define column headers and widths.
               Every cell then has a "c" element for its content.</preamble>   -->

		<!-- table header:  -->
        <ttcol align="left">Numeric ID</ttcol>
        <ttcol align="left">AEAD Algorithm</ttcol>
        <ttcol align="left">Use</ttcol>
        <ttcol align="center">Key Length (Octets)</ttcol>
        <ttcol align="left">Reference</ttcol>

		<!-- columns:  --> 
		<!-- 1st row:  -->
          <c>15</c>
          <c>AEAD_AES_SIV_CMAC_256</c>
          <c>Mand.</c>
          <c>16</c>
          <c><xref target="RFC5297"/></c>
		<!-- 2nd row:  -->
          <c>16</c>
          <c>AEAD_AES_SIV_CMAC_385</c>
          <c>Opt.</c>
          <c>24</c>
          <c><xref target="RFC5297"/></c>
		<!-- 3rd row:  -->
          <c>18</c>
          <c>AEAD_AES_SIV_CMAC_512</c>
          <c>Opt.</c>
          <c>32</c>
          <c><xref target="RFC5297"/></c>
		<!-- 4th row:  -->
          <c>32 - 32767</c>
          <c>Unassigned</c>
          <c></c>
          <c></c>
          <c></c>
		<!-- 5th row:  -->
          <c>32768 - 65535</c>
          <c>Reserved for Private or Experimental Use</c>
          <c></c>
          <c></c>
          <c><xref target="RFC5116"/></c>

    <!--      <postamble>which is a very simple example.</postamble>   -->
    </texttable>

	<t><list style="symbols">
		<t>In a PTP Registration Request message, this record MUST be contained exactly once.</t>
		<t>In this message at least the AEAD_AES_SIV_CMAC_256 algorithm MUST be included.</t>
		<t>If multiple AEAD algorithms are supported, the grantor SHOULD put the algorithm identifiers in descending priority in the record body.</t>
		<t>Strong algorithms with higher bit lengths SHOULD have higher priority.<vspace blankLines="1" /></t>

		<t>In a PTP Registration Success message, this record MUST be contained exactly once in the Current Parameters 
		   Container record and exactly once in the Next Parameters Container record.</t>
		<t>The Next Parameters Container MUST be present only during the update period.</t>
		<t>The KE server SHOULD choose the highest priority AEAD algorithm from the request message that grantor and KE server support.</t>
		<t>The KE server MAY ignore the priority and choose a different algorithm that grantor and KE server support.</t>
		<t>In a PTP Registration Success message, this record MUST contain exactly one AEAD algorithm.</t>
		<t>The selected algorithm MAY differ in the Current Parameters Container and Next Parameters Container records.</t>
	</list></t>


</section>


<section anchor="association-mode" title="Association Mode">

	<t>This record enables the NTS-KE server to distinguish between a group based request 
	(multicast, mixed multicast/unicast, Group-of-2) or a unicast request. A multicast 
	request carries a group number, while a unicast request contains an identification 
	attribute of the grantor (e.g. IP address or PortIdentity).</t>

	<t>Content and conditions:</t>
	<t><list style="symbols">
	   <t>In a PTP Key Request message, this record MUST be contained exactly once.</t>
	   <t>The record has a Record Type number of 1024 and the Critical Bit MAY be set.</t>
	   <t>The record body SHALL consist of two data fields:</t>
	</list></t>
	
	<texttable anchor="tbl_assoc" title="Association">
    <!--      <preamble>Tables use ttcol to define column headers and widths.
               Every cell then has a "c" element for its content.</preamble>   -->

		<!-- table header:  -->
        <ttcol align="left">Field</ttcol>
        <ttcol align="center">Octets</ttcol>
        <ttcol align="center">Offset</ttcol>

		<!-- columns:  --> 
		<!-- 1st row:  -->
          <c>Association Type</c>
          <c>2</c>
          <c>0</c>
		<!-- 2nd row:  -->
          <c>Association Value</c>
          <c>A</c>
          <c>2</c>

    <!--      <postamble>which is a very simple example.</postamble>   -->
    </texttable>

	<t><list style="symbols">
       <t>The Association Type is a 16-bit unsigned integer.</t>
       <t>The length of Association Value depends on the value of Association Type.</t>
       <t>All data in the fields are stored in network byte order.</t>
       <t>The type numbers of Association Type as well as the length and content of Association 
	      Value are shown in the following table and more details are given below.</t>
	</list></t>

	<texttable anchor="tbl_assoc_types" title="Association Types">
    <!--      <preamble>Tables use ttcol to define column headers and widths.
               Every cell then has a "c" element for its content.</preamble>   -->

		<!-- table header:  -->
        <ttcol align="left">Description</ttcol>
        <ttcol align="center">Assoc. Type Number</ttcol>
        <ttcol align="left">Association Mode</ttcol>
        <ttcol align="left">Association Value Content</ttcol>
        <ttcol align="center">Assoc. Value Octets</ttcol>

		<!-- columns:  --> 
		<!-- 1st row:  -->
          <c>Group</c>
          <c>0</c>
          <c>Multicast / Unicast*</c>
          <c>Group Number</c>
          <c>5</c>
		<!-- 2nd row:  -->
          <c>IPv4</c>
          <c>1</c>
          <c>Unicast</c>
          <c>IPv4 address of the target port</c>
          <c>4</c>
		<!-- 3rd row:  -->
          <c>IPv6</c>
          <c>2</c>
          <c>Unicast</c>
          <c>IPv6 address of the target port</c>
          <c>16</c>
		<!-- 4th row:  -->
          <c>802.3</c>
          <c>3</c>
          <c>Unicast</c>
          <c>MAC address of the target port</c>
          <c>6</c>
		<!-- 5th row:  -->
          <c>PortIdentity</c>
          <c>4</c>
          <c>Unicast</c>
          <c>PortIdentity of the target PTP entity</c>
          <c>10</c>

    <postamble>Unicast*: predefined groups of two (Group-of-2, Go2, see Group entry below)</postamble>
    </texttable>
	
    <t>Group:</t>
	<t><list style="symbols">
      <t>This association type allows a PTP instance to join a PTP multicast group.</t>
      <t>A group is identified by the PTP domain, the PTP profile (sdoId) and a sub-group attribute (see table below).</t>
      <t>The PTP domainNumber is an 8-bit unsigned integer in the closed range 0 to 255.</t>
      <t>The sdoId of a PTP domain is a 12-bit unsigned integer in the closed range 0 to 4095:
      <list style="symbols">
         <t>The most significant 4 bits are named the majorSdoId.</t>
         <t>The least significant 8 bits are named the minorSdoId.</t>
         <t>Reference: IEEE Std 1588-2019, 7.1.1		    </t>
      </list><spanx style="strong">sdoId = {majorSdoId || minorSdoId}</spanx></t>
	</list></t>
	
	<!--   <t>sdoId = {majorSdoId || minorSdoId}</t>	-->

	<t><list style="symbols">
      <t>The subGroup is 16-bit unsigned integer, which allows the division of a PTP multicast network into separate groups, each with individual security parameters.</t>
      <t>This also allows manually configured unicast connections (Group-of-2), which can include transparent clocks as well.</t>
      <t>The subGroup number is defined manually by the administrator.</t> 
      <t>Access to the groups is controlled by authorization procedures of the PTP devices (see <xref target="upfront-authorization"/>).</t>
      <t>If no subgroups are required (=multicast mode), this attribute MUST contain the value zero.<vspace blankLines="1" /></t>

      <t>The group number is eventually formed by concatenation of the following values:<vspace blankLines="1" />
	     <spanx style="strong">group number = {domainNumber || 4 bit zero padding || sdoId || subGroup}</spanx></t>
	</list></t>
	
	<!-- <t><spanx style="strong">group number = {domainNumber || 4 bit zero padding || sdoId || subGroup}</spanx></t>   -->

	<texttable anchor="tbl_group" title="Group Association">
    <preamble>This is equvalent to:</preamble>

		<!-- table header:  -->
        <ttcol align="center">Bits 7 - 4</ttcol>
        <ttcol align="center">Bits 3 - 0</ttcol>
        <ttcol align="center">Octets</ttcol>
        <ttcol align="center">Offset</ttcol>

		<!-- columns:  --> 
		<!-- 1st row:  -->
          <c>domainNumber (high)</c>
          <c>domainNumber (low)</c>
          <c>1</c>
          <c>0</c>

		<!-- 2nd row:  -->
          <c>zero padding</c>
          <c>majorSdoId</c>
          <c>1</c>
          <c>1</c>
		<!-- 3rd row:  -->
          <c>minorSdoId (high)</c>
          <c>minorSdoId (low)</c>
          <c>1</c>
          <c>2</c>
		<!-- 4th row:  -->
          <c>subgroup (high)</c>
          <c>subGroup (low)</c>
          <c>2</c>
          <c>4</c>

    <!--   <postamble></postamble>   -->
    </texttable>


<t>IPv4:</t>
	<t><list style="symbols">
      <t>This Association Type allows a requester to establish a PTP unicast connection to the desired grantor.</t>
      <t>The Association Value contains the IPv4 address of the target PTP entity.</t>
      <t>The total length is 4 octets.</t>
	</list></t>
	
<t>IPv6:</t>
	<t><list style="symbols">
      <t>This Association Type allows a requester to establish a PTP unicast connection to the desired grantor.</t>
      <t>The Association Value contains the IPv6 address of the target PTP entity.</t>
      <t>The total length is 16 octets.</t>
	</list></t>
	
<t>802.3:</t>
	<t><list style="symbols">
      <t>This Association Type allows a requester to establish a PTP unicast connection to the desired grantor.</t>
      <t>The Association Value contains the MAC address of the Ethernet port of the target PTP entity.</t>
      <t>The total length is 6 octets.</t>
      <t>This method supports the 802.3 mode in PTP, where no UDP/IP stack is used.</t>
	</list></t>
	
<t>PortIdentity:</t>
	<t><list style="symbols">
      <t>This Association Type allows a requester to establish a PTP unicast connection to the desired grantor.</t>
      <t>The Association Value contains the PortIdentity of the target PTP entity.</t>
      <t>The total length is 10 octets.<vspace blankLines="1" /></t>

      <t>The PortIdentity consists of the attributes clockIdentity and portNumber:<vspace blankLines="2" />
	     <spanx style="strong">PortIdentity = {clockIdentity || portNumber}</spanx></t>
	</list></t>
	
	<!--  <t>PortIdentity = {clockIdentity || portNumber}</t>   -->

	<t><list style="symbols">
      <t>The clockIdentity is an 8 octet array and the portNumber is a 16-bit unsigned integer.</t>
      <t>Source: IEEE Std 1588-2019, 5.3.5, 7.5</t>
	</list></t>

	
</section>



<section anchor="current-parameters-container" title="Current Parameters Container">

	<t>This record is a simple container that can carry an arbitrary number of NTS 
	records. It holds all security parameters relevant for the current validity period. 
	The content as well as further conditions are defined by the respective NTS messages. 
	The order of the included records is arbitrary and the parsing rules are so far 
	identical with the NTS message. One exception: An End of Message record SHOULD NOT 
	be present and MUST be ignored. When the parser reaches the end of the Record Body 
	quantified by the Body Length, all embedded records have been processed.</t>

	<t>Content and conditions:</t>
	<t><list style="symbols">
       <t>The record has a Record Type number of 1025 and the Critical Bit MAY be set.</t>
       </list></t>
		
	<t><list style="symbols">
       <t>In a PTP Key Grant message, this record MUST be contained exactly once.</t>
       <t>The record body is defined as a set of records and MAY contain the following records:</t>
       </list></t>

	<texttable anchor="tbl_curr_param_grant" title="Current Parameters Container for PTP Key Grant message">
    <!--      <preamble>Tables use ttcol to define column headers and widths.
               Every cell then has a "c" element for its content.</preamble>   -->

		<!-- table header:  -->
        <ttcol align="left">NTS Record Name</ttcol>
        <ttcol align="left">Comunication Type</ttcol>
        <ttcol align="left">Use</ttcol>
        <ttcol align="left">Reference</ttcol>

		<!-- columns:  --> 
		<!-- 1st row:  -->
          <c>Security Policies</c>
          <c>Multicast / Unicast</c>
          <c>Mand.</c>
          <c>This document, <xref target="security-policies"/></c>
		<!-- 2nd row:  -->
          <c>Security Associations (one or more)</c>
          <c>Multicast / Unicast</c>
          <c>Mand.</c>
          <c>This document, <xref target="security-association"/></c>
		<!-- 3rd row:  -->
          <c>Lifetime</c>
          <c>Multicast / Unicast</c>
          <c>Mand.</c>
          <c>This document, <xref target="lifetime"/></c>
		<!-- 4th row:  -->
          <c>Time until Update</c>
          <c>Multicast / Unicast</c>
          <c>Mand.</c>
          <c>This document, <xref target="time-until-update"/></c>
		<!-- 5th row:  -->
          <c>Grace Period</c>
          <c>Multicast / Unicast</c>
          <c>Opt.</c>
          <c>This document, <xref target="grace-period"/></c>
		<!-- 6th row:  -->
          <c>Ticket Key ID</c>
          <c>Unicast</c>
          <c>Mand.</c>
          <c>This document, <xref target="ticket-key-id"/></c>
		<!-- 7th row:  -->
          <c>Ticket</c>
          <c>Unicast</c>
          <c>Mand.</c>
          <c>This document, <xref target="ticket"/></c>

    <!--      <postamble>which is a very simple example.</postamble>   -->
    </texttable>


	<t><list style="symbols">
       <t>The records Security Policies, Lifetime and Time until Update MUST be contained exactly once.</t>
       <t>The number of the Security Association records depends on the content of the Security Policies record (see <xref target="security-policies"/>).</t>
       <t>At least one Security Association record MUST be included.</t>
       <t>The Grace Period record is optional and MAY be absent.</t>
       <t>If it is present, it MUST be included exactly once.</t>
       <t>In order to establish a unicast connection with the PTP Key Grant message, the records Ticket Key ID and Ticket MUST be contained exactly once.</t>
       <t>If the requester wants to join a multicast group, the records Ticket Key ID and Ticket MUST NOT be included.</t>
       </list></t>
	   
	<t><list style="symbols">
       <t>In a PTP Registration Success message, the Current Parameters Container record MUST be contained exactly once.</t>
       <t>The record body MAY contain the following records:</t>
       </list></t>

	<texttable anchor="tbl_curr_param_success" title="Current Parameters Container for PTP Registration Success Message">
    <!--      <preamble>Tables use ttcol to define column headers and widths.
               Every cell then has a "c" element for its content.</preamble>   -->

		<!-- table header:  -->
        <ttcol align="left">NTS Record Name</ttcol>
        <ttcol align="left">Use</ttcol>
        <ttcol align="left">Reference</ttcol>

		<!-- columns:  --> 
		<!-- 1st row:  -->
          <c>AEAD Algorithm Negotiation</c>
          <c>Mand.</c>
          <c>This document, <xref target="aead-negotiation"/></c>
		<!-- 2nd row:  -->
          <c>Lifetime</c>
          <c>Mand.</c>
          <c>This document, <xref target="lifetime"/></c>
		<!-- 3rd row:  -->
          <c>Time until Update</c>
          <c>Mand.</c>
          <c>This document, <xref target="time-until-update"/></c>
		<!-- 4th row:  -->
          <c>Grace Period</c>
          <c>Opt.</c>
          <c>This document, <xref target="grace-period"/></c>
		<!-- 5th row:  -->
          <c>Ticket Key ID</c>
          <c>Mand.</c>
          <c>This document, <xref target="ticket-key-id"/></c>
		<!-- 6th row:  -->
          <c>Ticket</c>
          <c>Mand.</c>
          <c>This document, <xref target="ticket"/></c>

    <!--      <postamble>which is a very simple example.</postamble>   -->
    </texttable>


	   
	<t><list style="symbols">
       <t>The records AEAD Algorithm Negotiation, Lifetime, Time until Update, Ticket Key ID and Ticket Key MUST be contained exactly once.</t>
       <t>The Grace Period record is optional and MAY be absent.</t>
       <t>If it is present, it MUST be included exactly once.</t> 
       </list></t>


</section>



<section anchor="end-of-message" title="End of Message">

<t>The End of Message record is defined in IETF RFC8915 <xref target="RFC8915"/>, 4:</t>

	<t><list style="empty">
       <t><spanx style="emph">&quot;The record sequence in an NTS message SHALL be terminated by an “End of 
          Message” record. The requirement that all NTS-KE messages be terminated by an End 
          of Message record makes them self-delimiting.&quot;</spanx></t>
       </list></t>

<t>Content and conditions:</t>

	<t><list style="symbols">
       <t>The record has a Record Type number of 0 and a zero-length body.</t>
       <t>The Critical Bit MUST be set.</t>
       <t>This record MUST occur exactly once as the final record of every NTS request and response message.</t>
       <t>This record SHOULD NOT be included in the container records and MUST be ignored if present.</t>
       <t>See also: IETF RFC8915, 4.1.1</t>
       </list></t>

</section>



<section anchor="error" title="Error">

<t>The Error record is defined in IETF RFC8915 <xref target="RFC8915"/>, 4.1.3. In addition to the 
Error codes 0 to 2 specified there the following Error codes 3 to 4 are defined:</t>

	<texttable anchor="tbl_error" title="Error Codes">
    <!--      <preamble>Tables use ttcol to define column headers and widths.
               Every cell then has a "c" element for its content.</preamble>   -->

		<!-- table header:  -->
        <ttcol align="left">Error Code</ttcol>
        <ttcol align="left">Description</ttcol>

		<!-- columns:  --> 
		<!-- 1st row:  -->
          <c>0</c>
          <c>Unrecognized Critical Record</c>
		<!-- 2nd row:  -->
          <c>1</c>
          <c>Bad Request</c>
		<!-- 3rd row:  -->
          <c>2</c>
          <c>Internal Server Error</c>
		<!-- 4th row:  -->
          <c>3</c>
          <c>Requester not Authorized</c>
		<!-- 5th row:  -->
          <c>4</c>
          <c>Grantor not Registered</c>
		<!-- 6th row:  -->
          <c>5 - 32767</c>
          <c>Unassigned</c>
		<!-- 7th row:  -->
          <c>32768 - 65535</c>
          <c>Reserved for Private or Experimental Use</c>

    <!--      <postamble>which is a very simple example.</postamble>   -->
    </texttable>



<t>Content and conditions:</t>

	<t><list style="symbols">
       <t>The record has a Record Type number of 2 and body length of two octets consisting 
	      of an unsigned 16-bit integer in network byte order, denoting an error code.</t>
       <t>The Critical Bit MUST be set.<vspace blankLines="1" /></t>

       <t>The Error code 3 "Requester not Authorized" is sent by the KE server if the requester 
	      is not authorized to join the desired multicast group.</t>
       <t>This Error code MUST NOT be included as a response to PTP Registration Request message.<vspace blankLines="1" /></t>
	   
       <t>The Error code 4 "Grantor not Registered" is sent by the KE server when the requester 
	      wants to establish a unicast connection to a grantor that is not registered with the KE server.</t>
       <t>This Error code MUST NOT be included as a response to a PTP Key Request message.</t>
       </list></t>

</section>



<section anchor="grace-period" title="Grace Period">

<t>The Grace Period determines the time period in which expired security 
parameters may still be accepted. It allows the verification of PTP messages, 
which have been secured with the previous key at the rotation time of the 
security parameters.</t>

<t>Content and conditions:</t>
	<t><list style="symbols">
       <t>The record has a Record Type number of 1026 and the Critical Bit SHOULD NOT be set.</t>
       <t>The record body consists of a 16-bit unsigned integer in network byte order.</t>
       <t>This value contains the transition time in seconds in which an expired key MAY still be accepted.</t>
       <t>A time of zero seconds is valid.</t>
       <t>If this optional record is absent, a default time of zero seconds is used unless a PTP 
	      profile defines something else.<vspace blankLines="1" /></t>

       <t>The Grace Period record MAY only appear as part of a PTP Key Grant or PTP Registration Success message.</t>
       <t>In a PTP Key Grant message, the Grace Period MAY be in the Current Parameters Container 
	      and Next Parameters Container records, as well as a part of the encrypted Ticket Container (if present).</t>
       <t>The Grace Period record MUST NOT appear more than once in each container or ticket.<vspace blankLines="1" /></t>

       <t>In a PTP Registration Success message, the Grace Period record MAY be present in the Current 
	      Parameters Container record as well as in the Next Parameters Container record.</t>
       <t>The Grace Period MUST NOT be included more than once in each of those container records.<vspace blankLines="1" /></t>

       <t>The Next Parameters Container MUST be present only during the update period.</t>
       </list></t>

</section>


<section anchor="lifetime" title="Lifetime">

<t>This record specifies the lifetime of a defined set of parameters. The 
value contained in this record is counted down by the receiver of the NTS 
message every second. When the value reaches zero, the parameters associated 
with this record are considered to have expired.</t>

<t>Content and conditions:</t>

	<t><list style="symbols">
       <t>The record has a Record Type number of 1027 and the Critical Bit MAY be set.</t>
       <t>The record body consists of a 32-bit unsigned integer in network byte order, denoting the 
	      expiration time of specific parameters in seconds.<vspace blankLines="1" /></t>

       <t>The maximum value is set by the NTS-KE administrator or the PTP profile.</t>
       <t>In conjunction with a PTP unicast establishment, the Lifetime of the unicast key, the ticket 
	      key and registration lifetime of a grantor with the KE server MUST be identical.<vspace blankLines="1" /></t>

       <t>The Lifetime record MAY only appear as part of a PTP Key Grant or PTP Registration Success message.</t>
       <t>In both messages, the Next Parameters Container MUST be present only during the update period.</t>
       <t>In a PTP Key Grant message, the Lifetime record MUST be included exactly once in the Current 
	      Parameters Container and Next Parameters Container records, as well as in the encrypted Ticket Container 
		  (only present in a unicast PTP Key Grant message).</t>
       <t>In a PTP Registration Success message, the Lifetime MUST be included exactly once in both records, 
	      Current Parameters Container and Next Parameters Container.</t>
       </list></t>

<t>Notes:</t>

	<t><list style="symbols">
       <t>Requests during the currently running lifetime will receive respectively adapted count values.</t>
       <t>The lifetime is a counter that is decremented and marks the expiration of defined parameters 
	      when the value reaches zero.</t>
       <t>The realization is implementation-dependent and can be done for example by a secondly decrementing.</t>
       <t>It must be ensured that jumps (e.g. by adjustment of the local clock) are avoided.</t>
       <t>The use of a monotonic clock is suitable for this.</t>
       <t>Furthermore, it is to be considered which consequences the drifting of the local clock can cause.</t>
       <t>With sufficiently small values of the lifetime (&lt;12 hours), this factor should be negligible.</t>
       </list></t>

</section>



<section anchor="mac-algo-negotiation" title="MAC Algorithm Negotiation">

<t>This optional record allows free negotiation of the MAC algorithm needed 
to generate the ICV. Since multicast groups are restricted to a shared 
algorithm, this record is only used in unicast mode.</t>

<t>Content and conditions:</t>

	<t><list style="symbols">
       <t>The record has a Record Type number of 1028 and the Critical Bit MAY be set.</t>
       <t>The record body contains a sequence of 16-bit unsigned integers in network byte order.<vspace blankLines="1" />
          <spanx style="strong">Supported MAC Algorithms = {MAC 1 || MAC 2 || …}</spanx><vspace blankLines="1" /></t>
		  
<!--   Supported MAC Algorithms = {MAC 1 || MAC 2 || …}<vspace blankLines="1" /></t>   -->

       <t>Each integer represents a MAC Algorithm Type defined in the table below.</t>
       <t>Duplicate identifiers SHOULD NOT be included.</t>
       <t>Each PTP node MUST support at least the HMAC-SHA256-128 algorithm.</t>
       </list></t>

	<texttable anchor="tbl_mac_algo" title="MAC Algorithms">
    <!--      <preamble>Tables use ttcol to define column headers and widths.
               Every cell then has a "c" element for its content.</preamble>   -->

		<!-- table header:  -->
        <ttcol align="left">MAC Algorithm Types</ttcol>
        <ttcol align="left">MAC Algorithm</ttcol>
        <ttcol align="center">ICV Length (octets)</ttcol>
        <ttcol align="left">Reference</ttcol>

		<!-- columns:  --> 
		<!-- 1st row:  -->
          <c>0</c>
          <c>HMAC-SHA256-128</c>
          <c>16</c>
          <c><xref target="FIPS-PUB-198-1"/>, <xref target="IEEE1588-2019"/></c>
		<!-- 2nd row:  -->
          <c>1</c>
          <c>HMAC-SHA256</c>
          <c>32</c>
          <c><xref target="FIPS-PUB-198-1"/></c>
		<!-- 3rd row:  -->
          <c>2</c>
          <c>AES-CMAC</c>
          <c>16</c>
          <c><xref target="RFC4493"/></c>
		<!-- 4th row:  -->
          <c>3</c>
          <c>AES-GMAC-128</c>
          <c>16</c>
          <c><xref target="RFC4543"/></c>
		<!-- 5th row:  -->
          <c>4</c>
          <c>AES-GMAC-192</c>
          <c>24</c>
          <c><xref target="RFC4543"/></c>
		<!-- 6th row:  -->
          <c>5</c>
          <c>AES-GMAC-256</c>
          <c>32</c>
          <c><xref target="RFC4543"/></c>
		<!-- 7th row:  -->
          <c>6 - 32767</c>
          <c>Unassigned </c>
          <c></c>
          <c></c>
		<!-- 8th row:  -->
          <c>32768 - 65535</c>
          <c>Reserved for Private or Experimental Use</c>
          <c></c>
          <c></c>

    <!--      <postamble>which is a very simple example.</postamble>   -->
    </texttable>


<t>In PTP multicast mode:</t>

	<t><list style="symbols"> 
       <t>This record is not necessary, since all PTP nodes in a multicast group MUST support the same MAC algorithm.</t>
       <t>Therefore, this record SHOULD NOT be included in a PTP Key Request massage and the NTS-KE server MUST ignore this record.</t>
       <t>Unless this is specified by a PTP profile, the HMAC-SHA256-128 algorithm SHALL be used by default.</t>
       </list></t>

<t>In PTP unicast mode:</t> 

	<t><list style="symbols">
       <t>In a PTP Key Request message, this record MAY be contained if the requester wants a unicast connection to a specific grantor.</t>
       <t>The requester MUST NOT send more than one record of this type.</t>
       <t>If this record is present, at least the HMAC-SHA256-128 MAC algorithm MUST be included.</t>
       <t>If multiple MAC algorithms are supported, the requester SHOULD put the desired algorithm identifiers in descending priority in the record body.</t>
       <t>Strong algorithms with higher bit lengths SHOULD have higher priority.</t>
       <t>The default MAC algorithm (HMAC-SHA256-128) MAY be omitted in the record.<vspace blankLines="1" /></t>

       <t>In a PTP Registration Request message, this record MUST be present and the grantor MUST include all supported MAC algorithms in any order.</t>
       <t>The KE server selects the algorithm after receiving a PTP Key Request message in unicast mode.</t>
       <t>The KE server SHOULD choose the highest priority MAC algorithm from the request message that grantor and requester support.</t>
       <t>The KE server MAY ignore the priority and choose a different algorithm that grantor and requester support.</t>
       <t>If the MAC Algorithm Negotiation record is not within the PTP Key Request message, the KE server MUST choose the default algorithm HMAC-SHA256-128.</t>
       </list></t>

<t>Initialization Vector (IV)</t>

	<t><list style="symbols">
       <t>If GMAC is to be supported as a MAC algorithm, then an Initialization Vector (IV) must be constructed according to IETF RFC 4543, 3.1.</t>
       <t>Therefore, the IV MUST be eight octets long and MUST NOT be repeated for a specific key.</t> 
       <t>This can be achieved, for example, by using a counter.</t>
       </list></t>

</section>



<section anchor="next-parameters-container" title="Next Parameters Container">

<t>This record is a simple container that can carry an arbitrary number of 
NTS records. It holds all security parameters relevant for the upcoming 
validity period. The content as well as further conditions are defined by 
the respective NTS messages. The order of the included records is arbitrary 
and the parsing rules are so far identical with the NTS message. One 
exception: An End of Message record SHOULD NOT be present and MUST be 
ignored. When the parser reaches the end of the Record Body quantified 
by the Body Length, all embedded records have been processed.</t>

<t>Content and conditions:</t>

	<t><list style="symbols">
       <t>The record has a Record Type number of 1029 and the Critical Bit MAY be set.</t>
       <t>The record body is defined as a set of records.</t>
       <t>The structure of the record body and all conditions MUST be identical to the rules 
	      described in <xref target="current-parameters-container"/> of this document.<vspace blankLines="1" /></t>

       <t>In both the PTP Key Grant and PTP Registration Success message, this record MUST 
	      be contained exactly once during the update period.</t>
       <t>Outside the update period, this record MUST NOT be included.</t>
       <t>In multicast mode, this record MAY also be missing if the requester is to be 
	      explicitly excluded from a multicast group after the security parameter rotation 
		  process by the KE server.<vspace blankLines="1" /></t>

       <t>The update period starts with the expiration of the Time until Update timer, which 
	      is stored in the Current Parameter Container record.</t>
       <t>In the PTP Key Grant and PTP Registration Success message, the expiration of the 
	      Lifetime marks the end of the update period.</t>
       <t>More details are described in <xref target="key-update"/>.</t>
       </list></t>

</section>


<section anchor="nts-message-type" title="NTS Message Type">

<t>This record enables the distinction between different NTS message types for PTP.</t>

<t>Content and conditions:</t>

	<t><list style="symbols">
       <t>The record has a Record Type number of 1030 and the Critical Bit MUST be set.</t>
       <t>The record body is a 16-bit unsigned integer in network byte order, denoting the type of the current NTS message for PTP.</t>
       <t>The message types are defined in the following table.</t> 
       <t>More details about the messages are described in <xref target="overview-nts-messages"/></t>
       </list></t>


	<texttable anchor="tbl_message_type" title="NTS message type numbers">
    <!--      <preamble>Tables use ttcol to define column headers and widths.
               Every cell then has a "c" element for its content.</preamble>   -->

		<!-- table header:  -->
        <ttcol align="left">NTS Message Type Number</ttcol>
        <ttcol align="left">NTS Message Name</ttcol>

		<!-- columns:  --> 
		<!-- 1st row:  -->
          <c>0</c>
          <c>PTP Key Request</c>
		<!-- 2nd row:  -->
          <c>1</c>
          <c>PTP Key Grant</c>
		<!-- 3rd row:  -->
          <c>2</c>
          <c>PTP Refusal</c>
		<!-- 4th row:  -->
          <c>3</c>
          <c>PTP Registration Request</c>
		<!-- 5th row:  -->
          <c>4</c>
          <c>PTP Registration Success</c>
		<!-- 6th row:  -->
          <c>5</c>
          <c>PTP Registration Revoke</c>
		<!-- 7th row:  -->
          <c>6 - 32767</c>
          <c>Unassigned</c>
		<!-- 8th row:  -->
          <c>32768 - 65535</c>
          <c>Reserved for Private or Experimental Use</c>

    <!--      <postamble>which is a very simple example.</postamble>   -->
    </texttable>

</section>



<section anchor="nts-message-version" title="NTS Message Version">

<t>This record enables the distinction between different NTS message versions for PTP. 
It provides the possibility to update or extend the NTS messages in future 
specifications.</t>

<t>Content and conditions:</t>

	<t><list style="symbols">
       <t>The record has a Record Type number of 1031 and the Critical Bit MUST be set.</t>
       <t>The record body consists of a tuple of two 8-bit unsigned integers in network byte order.</t>
       <t>The first octet represents the major version and the second octet the minor version.<vspace blankLines="1" />
          <spanx style="strong">NTS Message Version = {major version || minor version}</spanx><vspace blankLines="1" /></t>

		<!--   NTS Message Version = {major version || minor version}   -->

       <t>The representable version is therefore in the range 0.0 to 255.255 (e.g. v1.4 = 0104h).</t>
       <t>All NTS messages for PTPv2.1 described in this document are in version number 1.0.</t>
       <t>Thus the record body MUST match 0100h.</t>
       </list></t>

</section>


<section anchor="nts-next-protocol-nego" title="NTS Next Protocol Negotiation">

<t>The Next Protocol Negotiation record is defined in IETF RFC8915 <xref target="RFC8915"/>, 4.1.2:</t>

    <t><list>
		<t><spanx style="emph">&quot;The Protocol IDs listed in the client's NTS Next Protocol Negotiation record denote 
		those protocols that the client wishes to speak using the key material established 
		through this NTS-KE server session. Protocol IDs listed in the NTS-KE server's response 
		MUST comprise a subset of those listed in the request and denote those protocols that 
		the NTP server is willing and able to speak using the key material established through 
		this NTS-KE server session. The client MAY proceed with one or more of them. The request 
		MUST list at least one protocol, but the response MAY be empty.&quot;</spanx></t>
    </list></t>

<t>Content and conditions:</t>

	<t><list style="symbols">
       <t>The record has a Record Type number of 1 and the Critical Bit MUST be set.</t>
       <t>The record body consists of a sequence of 16-bit unsigned integers in network byte order.<vspace blankLines="1" />
          <spanx style="strong">Record body = {Protocol ID 1 || Protocol ID 2 || …}</spanx><vspace blankLines="1" /></t>

        <!--   Record body = {Protocol ID 1 || Protocol ID 2 || …}   -->

       <t>Each integer represents a Protocol ID from the IANA "Network Time Security Next Protocols" registry as shown in the table below.</t>
       <t>For NTS requests messages for PTPv2.1, only the Protocol ID for PTPv2.1 SHOULD be included.</t>
       <t>This prevents the mixing of records for different time protocols.</t> 
       </list></t>


	<texttable anchor="tbl_next_protocol_ids" title="NTS next protocol IDs">
    <!--      <preamble>Tables use ttcol to define column headers and widths.
               Every cell then has a "c" element for its content.</preamble>   -->

		<!-- table header:  -->
        <ttcol align="left">Protocol ID</ttcol>
        <ttcol align="left">Protocol Name</ttcol>
        <ttcol align="left">Reference</ttcol>

		<!-- columns:  --> 
		<!-- 1st row:  -->
          <c>0</c>
          <c>Network Time Protocol version 4 (NTPv4)</c>
          <c><xref target="RFC8915"/>, 7.7</c>
		<!-- 2nd row:  -->
          <c>1</c>
          <c>Precision Time Protocol version 2.1 (PTPv2.1)</c>
          <c>This document</c>
		<!-- 3rd row:  -->
          <c>2 - 32767</c>
          <c>Unassigned</c>
          <c></c>
		<!-- 4th row:  -->
          <c>32768 - 65535</c>
          <c>Reserved for Private or Experimental Use</c>
          <c></c>

    <!--      <postamble>which is a very simple example.</postamble>   -->
    </texttable>



<t>Possible NTP/PTP conflict:</t>

	<t><list style="symbols">
       <t>The support of multiple protocols in this record may lead to the problem 
	      that records in NTS messages can no longer be assigned to a specific time protocol.</t>
       <t>For example, an NTS request could include records for both NTP and PTP.</t>
       <t>However, NTS4NTP does not use NTS message types and the End of Message record is also 
	   not defined for the case of multiple NTS requests in one TLS message.</t>
       <t>This leads to the mixing of the records in the NTS messages.<vspace blankLines="1" /></t>

       <t>A countermeasure is the use of only a single time protocol in the NTS Next Protocol 
	   Negotiation record that explicitly assigns the NTS message to a specific time protocol.</t> 
       <t>When using NTS-secured NTP and NTS-secured PTP, two separate NTS requests i.e. two 
	   separate TLS sessions MUST be made.</t>
       </list></t>

	   
</section>


<section anchor="requesting-ptp-identity" title="Requesting PTP Identity">

<t>This record allows the KE server to associate an NTS unicast request of a requester 
with a registered grantor based on their address or identifier (e.g.: IP address or 
PortIdentity). Furthermore, this record allows the grantor to verify the origin of a 
secured PTP message that is currently transmitting a ticket.</t>

<t>Content and conditions:</t>

	<t><list style="symbols">
       <t>The record has a Record Type number of 1032 and the Critical Bit MAY be set.</t>
       <t>The record body consists of a set of Association Types together with their respective Association Values.</t>
       </list></t>


	<texttable anchor="tbl_identity_list" title="Requesting PTP identity list">
    <!--      <preamble>Tables use ttcol to define column headers and widths.
               Every cell then has a "c" element for its content.</preamble>   -->

		<!-- table header:  -->
        <ttcol align="left">Field</ttcol>
        <ttcol align="center">Octets</ttcol>
        <ttcol align="center">Offset</ttcol>

		<!-- columns:  --> 
		<!-- 1st row:  -->
          <c>Association Type 1</c>
          <c>2</c>
          <c>0</c>
		<!-- 2nd row:  -->
          <c>Association Value 1</c>
          <c>A1</c>
          <c>2</c>
		<!-- 3rd row:  -->
          <c>Association Type 2</c>
          <c>2</c>
          <c>A1+2</c>
		<!-- 4th row:  -->
          <c>Association Value 2</c>
          <c>A2</c>
          <c>A1+4</c>
		<!-- 5th row:  -->
          <c>Association Type n</c>
          <c>A2</c>
          <c>A1+A2+4</c>
		<!-- 6th row:  -->
          <c>Association Value n</c>
          <c>An</c>
          <c>A1+A2+6</c>

    <!--      <postamble>which is a very simple example.</postamble>   -->
    </texttable>



	<t><list style="symbols">
       <t>Structure and values are based on the contents defined in <xref target="association-mode"/> of this document.
	   <list style="symbols">
          <t>Therefore, the Association Type is a 16-bit unsigned integer.</t>
          <t>The length and content of Association Value depends on the value of Association Type.</t>
          <t>All bytes are stored in network byte order and the rules in <xref target="association-mode"/> MUST be followed.<vspace blankLines="1" /></t>
       </list></t>

       <t>A Requesting PTP Identity record MUST contain at least one association tuple (type + value).</t>
       <t>This record can contain several association tuples in any order.</t>
       <t>It MUST NOT contain more than one association tuple of the same type.<vspace blankLines="1" /></t>

       <t>In a PTP Key Request message, this record MUST be contained exactly once in the unicast mode, 
	      which depends on the content of the Association Mode record of this message.</t>
       <t>In this case the Requesting PTP Identity record MUST contain exactly one association tuple.</t>
       <t>This association tuple MUST contain one identification feature of the PTP requestor (IPv4, IPv6, 802.3 or PortIdentity).</t>
       <t>The association tuple MUST NOT contain the Group association type 0.<vspace blankLines="1" /></t>

       <t>In a PTP Key Grant message, this record MUST be contained exactly once in the encrypted Ticket Container.</t>
       <t>This record MUST contain exactly one association tuple.</t>
       <t>The record body MUST be identical to the Requesting PTP Identity record of the related PTP Key Request message.</t>
       <t>Therefore, the association tuple MUST NOT contain the Group association type 0.<vspace blankLines="1" /></t>

       <t>In a PTP Registration Request message, this record MUST be included exactly once.</t>
       <t>The grantor SHOULD add the following association tuples as far as they are available: IPv4, IPv6, 802.3 and PortIdentity.</t>
       <t>The grantor MUST NOT include the Group association type 0.<vspace blankLines="1" /></t>

       <t>This allows a requester to be assigned to a grantor, regardless of whether the requester specifies IPv4, IPv6, 802.3 or 
	      the PortIdentity of the grantor in its PTP Key Request message.</t>
       </list></t>




</section>


<section anchor="security-association" title="Security Association">

<t>This record contains the information &quot;how&quot; specific PTP message types must be secured. 
It comprises all dynamic (negotiable) values necessary to construct the AUTHENTICATION 
TLV (IEEE Std 1588-2019, 16.14.3). Static values and flags, such as the secParamIndicator, 
are described in more detail in <xref target="auth-tlv-parameters"/>.</t>

<t>Content and conditions:</t>

	<t><list style="symbols">
       <t>The record has a Record Type number of 1033 and the Critical Bit MAY be set.</t>
       <t>The record body is a sequence of various parameters in network byte order and MUST be 
	      formatted according to the following table:</t>
       </list></t>


	<texttable anchor="tbl_security_assoc" title="Security Association record">
    <!--      <preamble>Tables use ttcol to define column headers and widths.
               Every cell then has a "c" element for its content.</preamble>   -->

		<!-- table header:  -->
        <ttcol align="left">Field</ttcol>
        <ttcol align="center">Octets</ttcol>
        <ttcol align="center">Offset</ttcol>

		<!-- columns:  --> 
		<!-- 1st row:  -->
          <c>Security Parameter Pointer</c>
          <c>1</c>
          <c>0</c>
		<!-- 2nd row:  -->
          <c>Integrity Algorithm Type</c>
          <c>2</c>
          <c>1</c>
		<!-- 3rd row:  -->
          <c>Key ID</c>
          <c>4</c>
          <c>3</c>
		<!-- 4th row:  -->
          <c>Key Length</c>
          <c>2</c>
          <c>7</c>
		<!-- 5th row:  -->
          <c>Key</c>
          <c>K</c>
          <c>9</c>

    <!--      <postamble>which is a very simple example.</postamble>   -->
    </texttable>



	<t><list style="symbols">
       <t>In a PTP Key Grant message, the Security Association record MUST be included at least once in the 
	      Current Parameters Container record and the Next Parameters Container record.</t>
       <t>In unicast mode, the Security Association record MUST be included at least once in the 
	      encrypted Ticket Container as well.</t>
       <t>The Next Parameters Container record MUST be present only during the update period.</t>
       <t>The Ticket record MUST be present in unicast mode and MUST NOT be present in multicast mode.</t>
       <t>The number of Security Association records in the respective container or Ticket Container 
	      depends on the content of the associated Security Policies (see also <xref target="security-policies"/>).</t>
       </list></t>
	   
	   
<t>Security Parameter Pointer</t>

	<t><list style="symbols">
       <t>The Security Parameter Pointer (SPP) is an 8-bit unsigned integer in the closed range 0 to 255.</t>
       <t>This value enables the mutual assignment of SA, SP and AUTHENTICATION TLVs.</t>
       <t>The generation and management of the SPP is controlled by the KE server (see <xref target="sa-sp-management"/>).</t>
       </list></t>
	   
	   
<t>Integrity Algorithm Type</t>

	<t><list style="symbols">
       <t>This value is a 16-bit unsigned integer in network byte order.</t>
       <t>The possible values are equivalent to the MAC Algorithm Types from the table in <xref target="mac-algo-negotiation"/>.</t>
       <t>The value used depends on the negotiated or predefined MAC algorithm.</t>
       </list></t>
	   
	   
<t>Key ID</t>

	<t><list style="symbols">
       <t>The Key ID is a 32-bit unsigned integer in network byte order.</t>
       <t>The field length is oriented towards the structure of the AUTHENTICATION TLV.</t>
       <t>The generation and management of the Key ID is controlled by the KE server.</t>
       <t>The NTS-KE server MUST ensure that every Key ID is unique.
	   <list style="symbols">
           <t>The value can be either a random number or an enumeration.</t>
           <t>Previous Key IDs SHOULD NOT be reused for a certain number of rotation periods or a defined period of 
              time (see <xref target="additional-mechanisms"/>).</t>
           </list></t>
       </list></t>	   
	   
<t>Key Length</t>
	<t><list style="symbols">

       <t>This value is a 16-bit unsigned integer in network byte order, denoting the length of the key.</t>
       </list></t>
	   

<t>Key</t>

	<t><list style="symbols">
       <t>The value is a sequence of octets with a length of Key Length.</t>
       <t>This symmetric key is needed together with the MAC algorithm to calculate the ICV.</t>
       <t>It can be both a group key (multicast mode) or a unicast key (unicast mode).</t>
       </list></t>




</section>



<section anchor="security-policies" title="Security Policies">

<t>This record contains the information &quot;which&quot; PTP message types must be secured.</t>

<t>Content and conditions:</t>

	<t><list style="symbols">
       <t>The record has a Record Type number of 1034 and the Critical Bit MAY be set.</t>
       <t>The record body contains a sequence of tuples in network byte order:<vspace blankLines="1" />
          <spanx style="strong">Record body = {Security Policies = {tuple 1 || tuple 2 || tuple 3 || tuple n}}</spanx>
		  <vspace blankLines="1" /></t>

     <!--   Security Policies = {tuple 1 || tuple 2 || tuple 3 || tuple n}   -->

       <t>Each tuple has a length of 2 octets and consists of a sequence of a PTP Message Type 
	      and a Security Parameter Pointer.</t>
       </list></t>



	<texttable anchor="tbl_security_pol_tuple" title="Security Policy tuple">
    <!--      <preamble>Tables use ttcol to define column headers and widths.
               Every cell then has a "c" element for its content.</preamble>   -->

		<!-- table header:  -->
        <ttcol align="left">Field</ttcol>
        <ttcol align="center">Octets</ttcol>
        <ttcol align="center">Offset</ttcol>

		<!-- columns:  --> 
		<!-- 1st row:  -->
          <c>PTP Message Type</c>
          <c>1</c>
          <c>0</c>
		<!-- 2nd row:  -->
          <c>Security Parameter pointers</c>
          <c>1</c>
          <c>1</c>

    <!--      <postamble>which is a very simple example.</postamble>   -->
    </texttable>



	<t><list style="symbols">
       <t>The PTP Message Type is an 8-bit unsigned integer.</t>
       <t>The most significant 4 bits are zero-padded and the least significant 4 bits are the PTP message type:</t> 
       </list></t>

<t>Structure of PTP Message Type (see also <xref target="IEEE1588-2019"/>, 13.3.2.3, table 36):</t>

	<texttable anchor="tbl_ptp_message_type" title="PTP Message Type">
        <!--   <preamble></preamble>   -->

		<!-- table header:  -->
        <ttcol align="left">Bits 7 - 4</ttcol>
        <ttcol align="left">Bits 3 - 0</ttcol>

		<!-- columns:  --> 
		<!-- 1st row:  -->
          <c>Zero Padding</c>
          <c>PTP Message type</c>

    <!--      <postamble>which is a very simple example.</postamble>   -->
    </texttable>


	<t><list style="symbols">
       <t>The Security Parameter Pointer (SPP) is an 8-bit unsigned integer in the closed range 0 to 255.<vspace blankLines="1" /></t>

       <t>The record body MUST contain at least one tuple.</t>
       <t>A tuple associates a PTP message type with an SPP.</t>
       <t>Every PTP message type that is mentioned in the Security Policies record MUST be secured.</t>
       <t>Thus, a PTP message type that is not included in this record MUST NOT contain an AUTHENTICATION TLV and will not be secured.</t>
       <t>Multiple tuples with the same PTP message type MUST NOT be included.</t>
       <t>Multiple tuples MAY use the same SPP to use a shared security association or an individual one.<vspace blankLines="1" /></t>

       <t>For the number of contained and different SPPs in the Security Policies record, the same number of security associations MUST be created.</t>
       <t>The number of security associations determines the number of Security Associations records 
	      in the respective container record (e.g. Current Parameters Container).<vspace blankLines="1" /></t>

       <t>In a PTP Key Grant message, this record MUST be included exactly once each in the Current 
	      Parameters Container record, the Next Parameters Container record as well as the encrypted Ticket Container record.</t>
       <t>The Next Parameters Container record MUST be present only during the update period.</t>
       <t>The Ticket record MUST be present in unicast mode and MUST NOT be present in multicast mode.</t>
       </list></t>

</section>



<section anchor="ticket" title="Ticket">

<t>This record contains the parameters of the selected AEAD algorithm, as well as an 
encrypted Ticket Container record. The encrypted record contains all the necessary 
security parameters that the grantor needs for a secured PTP unicast connection to 
the requester. The ticket container is encrypted by the NTS-KE server with the 
symmetric ticket key which is also known to the grantor. The requester is not able 
to decrypt the ticket container.</t>

<t>Content and conditions:</t>

	<t><list style="symbols">
       <t>The record has a Record Type number of 1035 and the Critical Bit MAY be set.</t>
       <t>The record body consists of several data fields and MUST be formatted as follows.</t>
       </list></t>



	<texttable anchor="tbl_ticket" title="Structure of a Ticket record">
    <!--      <preamble>Tables use ttcol to define column headers and widths.
               Every cell then has a "c" element for its content.</preamble>   -->

		<!-- table header:  -->
        <ttcol align="left">Field</ttcol>
        <ttcol align="center">Octets</ttcol>
        <ttcol align="center">Offset</ttcol>

		<!-- columns:  --> 
		<!-- 1st row:  -->
          <c>Nonce Length</c>
          <c>2</c>
          <c>0</c>
		<!-- 2nd row:  -->
          <c>Nonce</c>
          <c>N</c>
          <c>2</c>
		<!-- 3rd row:  -->
          <c>Encrypted Ticket Container Length</c>
          <c>2</c>
          <c>N+2</c>
		<!-- 4th row:  -->
          <c>Encrypted Ticket Container</c>
          <c>C</c>
          <c>N+4</c>

    <!--      <postamble>which is a very simple example.</postamble>   -->
    </texttable>



	<t><list style="symbols">
       <t>In a PTP Key Grant message, this record MUST be included exactly once each in the 
	      Current Parameters Container record and the Next Parameters Container record if the 
		  requester wants a unicast communication to a specific grantor.</t>
       <t>The Next Parameters Container record MUST be present only during the update period.</t> 
       </list></t>

<t>Nonce Length</t>

	<t><list style="symbols">
       <t>This is a 16-bit unsigned integer in network byte order, denoting the length of 
	      the Nonce field.</t>
       </list></t>

<t>Nonce</t>

	<t><list style="symbols">
       <t>This field contains the Nonce needed for the AEAD operation.</t>
       <t>The length and conditions attached to the Nonce depend on the AEAD algorithm used.</t>
       <t>More details and conditions are described in <xref target="aead-operation"/>.</t>
       </list></t>

<t>Encrypted Ticket Container Length</t>

	<t><list style="symbols">
       <t>This is a 16-bit unsigned integer in network byte order, denoting the length 
	      of the Encrypted Ticket Container field.</t>
       </list></t>

<t>Encrypted Ticket Container</t>

	<t><list style="symbols">
       <t>This field contains the output of the AEAD operation (“Ciphertext”) after the 
	      encryption process of the respective Ticket Container record.</t>
       <t>The plaintext of this field is described in <xref target="ticket-container"/>.</t>
       <t>More details about the AEAD process and the required input data are described in 
	      <xref target="aead-operation"/>.</t>
       </list></t>


</section>





<section anchor="ticket-container" title="Ticket Container">

<t>This record is a simple container that can carry an arbitrary number of NTS 
records. It contains all relevant security parameters that a grantor needs for a 
secured unicast connection. The order of the included records is arbitrary and the 
parsing rules are so far identical with the NTS message. One exception: An End of 
Message record SHOULD NOT be present and MUST be ignored. When the parser reaches 
the end of the Record Body quantified by the Body Length, all embedded records have 
been processed. The Ticket Container record serves as input parameter for the AEAD 
operation (see <xref target="aead-negotiation"/>) and is transmitted encrypted within the Ticket record 
(see <xref target="ticket"/>).</t>

<t>Content and conditions:</t>

	<t><list style="symbols">
       <t>The record has a Record Type number of 1036 and the Critical Bit MAY be set.</t>
       <t>The record body is defined as a set of records and MAY contain the following records.</t>
       </list></t>


	<texttable anchor="tbl_ticket_container" title="Structure of a Ticket Container">
    <!--      <preamble>Tables use ttcol to define column headers and widths.
               Every cell then has a "c" element for its content.</preamble>   -->

		<!-- table header:  -->
        <ttcol align="left">NTS Record Name</ttcol>
        <ttcol align="center">Use</ttcol>
        <ttcol align="center">Reference</ttcol>

		<!-- columns:  --> 
		<!-- 1st row:  -->
          <c>Requesting PTP Identity</c>
          <c>mand.</c>
          <c>This document, <xref target="requesting-ptp-identity"/></c>
		<!-- 2nd row:  -->
          <c>Security Policies</c>
          <c>mand.</c>
          <c>This document, <xref target="security-policies"/></c>
		<!-- 3rd row:  -->
          <c>Security Association (one or more)</c>
          <c>mand.</c>
          <c>This document, <xref target="security-association"/></c>
		<!-- 4th row:  -->
          <c>Lifetime</c>
          <c>mand.</c>
          <c>This document, <xref target="lifetime"/></c>
		<!-- 5th row:  -->
          <c>Time until Update</c>
          <c>mand.</c>
          <c>This document, <xref target="time-until-update"/></c>
		<!-- 6th row:  -->
          <c>Grace Period</c>
          <c>opt. (conditional)</c>
          <c>This document, <xref target="grace-period"/></c>

    <!--      <postamble>which is a very simple example.</postamble>   -->
    </texttable>


	<t><list style="symbols">
       <t>The records Requesting PTP Identity, Security Policies, Lifetime and Time until Update 
	      MUST be contained exactly once.</t>
       <t>The number of the Security Association records depends on the content of the Security 
	      Policies record (see <xref target="security-policies"/>).</t>
       <t>All records within this Ticket Container (except Requesting PTP Identity) MUST be 
	      identical to the records of the respective Current Parameter Container.</t>
       <t>All records within this Ticket Container (except Requesting PTP Identity) MUST be 
	      identical to the records of the respective Next Parameter Container.</t>
       <t>The presence of the Grace Period record also depends on the respective Current/Next 
	      Parameter container.</t>
       <t>If a Grace Period record is present in the Current/Next Parameter container, it MUST 
	      also be present in the respective Ticket Container.</t>
       <t>If it is not present, it MUST NOT be included in the Ticket Container.</t>
       </list></t>


</section>



<section anchor="ticket-key" title="Ticket Key">

<t>This record contains the ticket key, which together with an AEAD algorithm is 
used to encrypt and decrypt the ticket.</t>

<t>Content and conditions:</t>

	<t><list style="symbols">
       <t>The record has a Record Type number of 1037 and the Critical Bit MAY be set.</t>
       <t>The record body consists of a sequence of octets holding the symmetric key for the AEAD function.</t>
       <t>The generation and length of the key MUST meet the requirement of the associated AEAD 
	      algorithm.<vspace blankLines="1" /></t>

       <t>In a PTP Registration Success message, this record MUST be included exactly once each in 
	      the Current Parameters Container record and the Next Parameters Container record.</t>
       <t>The Next Parameters Container record MUST be present only during the update period.</t>
       </list></t>

</section>



<section anchor="ticket-key-id" title="Ticket Key ID">

<t>The Ticket Key ID record is a unique identifier that allows a grantor to identify 
the associated ticket key.</t>

<t>Content and conditions:</t>

	<t><list style="symbols">
       <t>The record has a Record Type number of 1038 and the Critical Bit MAY be set.</t>
       <t>The record body consists of a 32-bit unsigned integer in network byte order.</t>
       <t>The generation and management of the ticket key ID is controlled by the NTS-KE server.</t>
       <t>The NTS-KE server must ensure that every ticket key has a unique number.
	   <list style="symbols">
	      <t>The value is implementation dependent and MAY be either a random number, a hash value or an 
		     enumeration.</t>
	      <t>Previous IDs SHOULD NOT be reused for a certain number of rotation periods or a defined 
		     period of time.</t>
          </list></t>
       <t>In a PTP Key Grant message, this record MUST be included exactly once each in the Current 
	      Parameters Container record and the Next Parameters Container record if a unicast connection 
		  is to be established.</t>
       <t>If the requester wishes to join a multicast group, the Ticket Key ID record MUST NOT be 
	      included in the container records.</t>
       <t>In a PTP Registration Success message, this record MUST be included exactly once in the Current 
	      Parameters Container record and once in the Next Parameters Container record.</t>
       <t>The Next Parameters Container record MUST be present only during the update period.</t>
       <t>The Ticket record MUST be present in unicast mode and MUST NOT be present in multicast mode.</t> 
       </list></t>

</section>




<section anchor="time-until-update" title="Time until Update">

<t>The Time until Update (TuU) record specifies the point in time at which new security 
parameters are available. The value contained in this record is counted down by the 
receiver of the NTS message every second. When the value reaches zero, the update 
period begins and NTS response messages typically contain the Next Parameter Container 
record for a certain period of time (see also <xref target="key-update"/>).</t>

<t>Content and conditions:</t>

	<t><list style="symbols">
       <t>The record has a Record Type number of 1039 and the Critical Bit MAY be set.</t>
       <t>The record body consists of a 32-bit unsigned integer in network byte order, 
	      denoting the begin of the update period in seconds.<vspace blankLines="1" /></t>

       <t>The value in the TuU MUST be less than the value in the associated Lifetime record 
	      (in the same container or ticket).</t>
       <t>If the value in the TuU is greater than zero in the Current Parameter Container, 
	      the corresponding message MUST NOT contain a Next Parameters Container.</t>
       <t>If the value in the TuU is zero in the Current Parameters Container, the corresponding 
	      NTS message MAY contain the Next Parameters Container record.<vspace blankLines="1" /></t>

       <t>The Time until Update record MAY only appear as part of a PTP Key Grant or PTP 
	      Registration Success message.</t>
       <t>In both messages, the Next Parameters Container MUST be present only during the update period.</t>
       <t>In a PTP Key Grant message, the Time until Update record MUST be included exactly once each 
	      in the Current Parameters Container and Next Parameters Container records, as well as in the 
		  encrypted Ticket Container (only present in a unicast PTP Key Grant message).</t>
       <t>In a PTP Registration Success message, the Time until Update MUST be included exactly once 
	      each in the Current Parameters Container and Next Parameters Container records.</t>
       <t>In both messages, the Next Parameters Container record MUST be present only during the update period.</t>
       </list></t>

<t>Notes:</t>

	<t><list style="symbols">
       <t>Requests during the currently running lifetime will receive respectively adapted count values 
	      for Time until Update.</t>
       <t>During the update period the value for TuU in the Current Parameters Container will be zero.</t>
       </list></t>



</section>

</section>




<section anchor="additional-mechanisms" title="Additional Mechanisms">

<t>This section provides information about the use of the negotiated AEAD algorithm 
as well as the generation of the security policy pointers.</t>


<section anchor="aead-operation" title="AEAD Operation">

<t>General information about AEAD:</t>

	<t><list style="symbols">
       <t>The AEAD operation enables the integrity protection and the optional encryption 
	      of the given data, depending on the input parameters.</t>
       <t>While the structure of the AEAD output after the securing operation is determined 
	      by the negotiated AEAD algorithm, it usually contains an authentication tag in 
		  addition to the actual ciphertext.</t>
       <t>The authentication tag provides the integrity protection, whereas the ciphertext 
	      represents the encrypted data.</t>
       <t>The AEAD algorithms supported in this document (see <xref target="aead-negotiation"/>) 
	      always return an authentication tag with a fixed length of 16 octets.</t> 
       <t>The size of the following ciphertext is equal to the length of the plaintext.</t> 
       <t>The concatenation of authentication tag and ciphertext always form the unit 
	      “Ciphertext”:<vspace blankLines="1" /><spanx style="strong">Ciphertext = {authentication 
		  tag || ciphertext}</spanx><vspace blankLines="1" /></t>

       <!--   Ciphertext = {authentication tag || ciphertext}   -->

       <t>Hint: The term “Ciphertext” is distinguished between upper and lower case letters.</t>
       <t>The following text always describes "Ciphertext".</t>
       <t>Separation of the information concatenated in Ciphertext is not necessary at any time.<vspace blankLines="1" /></t>

       <t>Six parameters are relevant for the execution of an AEAD operation:
	      <list style="symbols">
          <t>AEAD (...):  is the AEAD algorithm itself</t>
          <t>A:  Associated Data</t>
          <t>N:  Nonce</t>
          <t>K:  Key</t>
          <t>P:  Plaintext</t>
          <t>C:  Ciphertext</t>
          </list></t>

       <t>The protection and encryption of the data is done as follows:  C = AEAD (A, N, K, P)</t>
       <t>Therefore, the output of the AEAD function is the Ciphertext.<vspace blankLines="1" /></t>

       <t>The verification and decryption of the data is done this way:  P = AEAD (A, N, K, C)</t>
       <t>The output of the AEAD function is the Plaintext if the integrity verification is successful.</t> 
       </list></t>


<t>AEAD algorithm and input/output values for the Ticket record:</t>

	<t><list style="symbols">
       <t>AEAD (…):
	      <list style="symbols">
          <t>The AEAD algorithm that is negotiated between grantor and NTS-KE server during 
		     the registration phase.</t>
          <t>A list of the AEAD algorithms considered in this document can be found in 
		     <xref target="aead-negotiation"/>.</t>
          </list></t>

       <t>Associated Data:
	      <list style="symbols">
          <t>The Associated Data is an optional AEAD parameter and can be of any length and 
		     content, as long as the AEAD algorithm does not give any further restrictions.</t>
          <t>In addition to the Plaintext, this associated data is also included in the 
		     integrity protection.</t>
          <t>When encrypting or decrypting the Ticket Container record, this parameter 
		     MUST remain empty.</t>
          </list></t>

       <t>Nonce:	
	      <list style="symbols">
          <t>Corresponds to the value from the Nonce field in the Ticket (<xref target="ticket"/>).</t>
          <t>The requirements and conditions depend on the selected AEAD algorithm.</t>
          <t>For the AEAD algorithms defined in <xref target="aead-negotiation"/> (with 
		     numeric identifiers 15, 16, 17), a cryptographically secure random number MUST be used.</t> 
          <t>Due to the block length of the internal AES algorithm, the Nonce SHOULD have a length 
		     of 16 octets.</t>
          </list></t>

       <t>Key:
	      <list style="symbols">
          <t>This is the symmetric key required by the AEAD algorithm.</t>
          <t>The key length depends on the selected algorithm.</t>
          <t>When encrypting or decrypting the Ticket Container record, the ticket key MUST be used.</t>
          </list></t>

       <t>Plaintext:
	      <list style="symbols">
          <t>This parameter contains the data to be encrypted and secured.</t>
          <t>For AEAD encryption, this corresponds to the Ticket Container record with all records inside.</t>
          <t>This is also the output of the AEAD operation after the decryption process.</t>
          </list></t>

       <t>Ciphertext:
	      <list style="symbols">
          <t>Corresponds to the value from the Encrypted Ticket Container field in the Ticket 
		     (<xref target="ticket"/>).</t>
          <t>The Ciphertext is the output of the AEAD operation after the encryption process.</t>
          <t>This is also the input parameter for the AEAD decryption operation.</t>
          </list></t>
       </list></t>

</section>



<section anchor="sa-sp-management" title="SA/SP Management">

<t>This section describes the requirements and recommendations attached to SA/SP management, 
as well as details about the generation of identifiers.</t>

<t>Requirements for the Security Association Database management:</t>

	<t><list style="symbols">
       <t>The structure and management of the Security Association Database (SAD) are 
	      implementation-dependent both on the NTS-KE server and on the PTP devices.</t>
       <t>An example of this, as well as other recommendations, are described in Annex B.</t>
       <t>A PTP device MUST contain exactly one SAD and Security Policy Database (SPD).</t>
       <t>For multicast and Group-of-2 connections, SPPs MUST NOT occur more than once 
	      in the SAD of a PTP device.</t>
       <t>For unicast connections, SPPs MAY occur more than once in the SAD of a PTP device.</t>
       <t>The NTS-KE server MUST ensure that SPPs can be uniquely assigned to a multicast 
	      group or unicast connection.</t>
       <t>This concerns both the NTS-KE server and all PTP devices assigned to the NTS-KE server.</t>
      </list></t>

<t>SPP generation:</t>

	<t><list style="empty">
       <t>The generation of the SPP always takes place on the NTS-KE server and enables 
	      the identification of a corresponding SA. The value of the SPP can be either a 
		  random number or an enumeration. An SPP used in any multicast group MUST NOT 
		  occur in any other multicast group or unicast connection. If a multicast group 
		  or unicast connection is removed by the NTS-KE server, the released SPPs MAY be 
		  reused for new groups or unicast connections. Before reusing an SPP, the NTS-KE 
		  server MUST ensure that the SPP is no longer in use in the PTP network (e.g. 
		  within Next Parameter). In different PTP devices, an SPP used in a unicast 
		  connection MAY also occur in another unicast connection, as long as they are 
		  not used in multicast groups.</t>
      </list></t>


<t>Key/Key ID generation:</t>

	<t><list style="empty">
       <t>The generation of the keys MUST be performed by using a Cryptographically 
	      Secure Pseudorandom Number Generator (CSPRNG) on the NTS-KE server (see also 
		  <xref target="key-generation"/>). The length of the keys depends on the MAC algorithm used. The 
		  generation and management of the Key ID is also controlled by the KE server. 
		  The NTS-KE server MUST ensure that every Key ID is unique at least within an 
		  SA with multiple parameter sets. The value of the Key ID is 
		  implementation dependent and MAY be either a random number, a hash value or 
		  an enumeration. Key IDs of expired keys MAY be reused but SHOULD NOT be reused 
		  for a certain number of rotation periods or a defined period of time. Before 
		  reusing a Key ID, the NTS-KE server MUST be ensured that the Key ID is no 
		  longer in use in the PTP network (e.g. within Next Parameter).</t>
      </list></t>


</section>

</section>
</section>


<section anchor="new-ticket-tlv" title="New TICKET TLV for PTP Messages">

<t>Once a PTP port is registered as a grantor for association in unicast mode another PTP 
port (requester) can associate with it by first requesting a key from the KE server with
 Association Type in the Association Mode record set to one of the values 1 to 4 (IPv4, 
 IPv6, 802.3 or PortIdentity), and Association Values to the related address of the 
 registered port. With the reception of the key grant the requester obtains the unicast 
 key and the Ticket record containing the encrypted ticket container (see <xref target="exchange-ticket-based"/> 
 and <xref target="ticket"/>). The ticket container (see <xref target="ticket-container"/>)
 includes the identification of the requester, the SAs along with the unicast key as well 
 as the Lifetime/Time until Update data. </t>

<t>To provide the grantor with the security data, the requester sends a secured unicast 
request to the grantor, e.g. an Announce request (= Signaling message with a 
REQUEST_UNICAST_TRANSMISSION TLV with Announce as messageType in the TLV), which is 
secured with the unicast key.</t>

<t>To accomplish that, the requester sends a newly defined TICKET TLV with the Ticket 
container embedded and the AUTHENTICATION TLV with the PTP unicast negotiation message. 
The TICKET TLV must be positioned before the AUTHENTICATION TLV to include the TICKET TLV 
in the securing by the ICV. The receiving grantor decrypts the Ticket container from the 
TICKET TLV getting access to the information therein. With the contained unicast key, the 
grantor checks the requester identity and the authenticity of the request message.</t>

<t>Thereafter all secured unicast messages between grantor and requester will use the 
unicast key for generating the ICV in the AUTHENTICATION TLV for authentication of the 
message until the unicast key expires.</t>

<t>If the requester’s identity does not match with the Requesting PTP Identity record 
in the Ticket Container and/or the ICV in the AUTHENTICATION TLV is not identical to 
the generated ICV by the grantor, then the unicast request message shall be denied.</t>

<t>The TICKET TLV structure is given in <xref target="tbl_ticket_tlv"/> below.</t>


	<texttable anchor="tbl_ticket_tlv" title="Structure of the TICKET TLV">
    <!--      <preamble>Tables use ttcol to define column headers and widths.
               Every cell then has a "c" element for its content.</preamble>   -->

		<!-- table header:  -->
        <ttcol align="left">Field</ttcol>
        <ttcol align="center">Octets</ttcol>
        <ttcol align="center">Offset</ttcol>

		<!-- columns:  --> 
		<!-- 1st row:  -->
          <c>tlvType</c>
          <c>2</c>
          <c>0</c>
		<!-- 2nd row:  -->
          <c>lengthField</c>
          <c>2</c>
          <c>2</c>
		<!-- 3rd row:  -->
          <c>Ticket record</c>
          <c>T</c>
          <c>4</c>

    <!--      <postamble>which is a very simple example.</postamble>   -->
    </texttable>



<t>To comply with the TLV structure of IEEE Std 1588-2019 (<xref target="IEEE1588-2019"/>, 14.1)
   the TICKET TLV is structured as presented in <xref target="tbl_ticket_tlv"/> with a newly defined tlvType, a 
   respective length field and the Ticket record (see <xref target="ticket"/>) containing 
   the encrypted Ticket container. Eventually it may be necessary to define the Ticket 
   TLV externally to IEEE 1588 SA. Then the structure should follow IEEE Std 1588-2019 
   (<xref target="IEEE1588-2019"/>, 14.3) to define a new standard organization extension 
   TLV as presented in <xref target="tbl_ticket_tlv_ext"/> below.</t>


	<texttable anchor="tbl_ticket_tlv_ext" title="Structure of an organization extension TLV form for the TICKET TLV">
    <!--      <preamble>Tables use ttcol to define column headers and widths.
               Every cell then has a "c" element for its content.</preamble>   -->

		<!-- table header:  -->
        <ttcol align="left">Field</ttcol>
        <ttcol align="center">Octets</ttcol>
        <ttcol align="center">Offset</ttcol>

		<!-- columns:  --> 
		<!-- 1st row:  -->
          <c>tlvType</c>
          <c>2</c>
          <c>0</c>
		<!-- 2nd row:  -->
          <c>lengthField</c>
          <c>2</c>
          <c>2</c>
		<!-- 3rd row:  -->
          <c>organizationId</c>
          <c>3</c>
          <c>4</c>
		<!-- 4th row:  -->
          <c>organizationSubType</c>
          <c>3</c>
          <c>7</c>
		<!-- 5th row:  -->
          <c>Ticket record</c>
          <c>T</c>
          <c>10</c>

    <!--      <postamble>which is a very simple example.</postamble>   -->
    </texttable>



<t>To transport the TICKET TLV with the Ticket container embedded via the PTP unicast 
negotiation message two possible solutions exist:</t>

	<t><list style="letters">
       <t>The TICKET TLV can be added to the PTP message preceding the AUTHENTICATION TLV as 
       shown in Figure 48 of IEEE Std 1588-2019 (<xref target="IEEE1588-2019"/>, 16.14.1.1). 
	   For this solution, a completely new TICKET TLV for IEEE Std 1588-2019 needs to be defined.</t>

       <t>In an alternative solution the TICKET TLV is send embedded in the RES field of the 
       AUTHENTICATION TLV as shown in Figure 49 of IEEE Std 1588-2019 (<xref target="IEEE1588-2019"/>, 
	   16.14.3). In this case the RP flag in the secParamIndicator must be set. As at the moment 
	   the use of the RES field is not permitted and the structure of the RES field is limited 
	   to UInteger (see <xref target="IEEE1588-2019"/>, 16.14.3.8 ) the new usage needs to be defined:
	   <vspace blankLines="1" />
	   <spanx style="emph">&quot;16.14.3.8 RES (UInteger R):   This field is optional. If present, it shall have a data type 
	   of UInteger with a length of R octets. For this edition, the value of RP in the 
	   secParamIndicator field shall be FALSE and the value of RP shall be 0.&quot;</spanx></t>
      </list></t>
	  
<t>Which solution is chosen is a political question, not a technical one and needs to 
be discussed in the IEEE 1588 SA. The same applies to the format of the TICKET TLV 
(standard TLV or organization extension TLV).</t>


</section>

<section anchor="auth-tlv-parameters" title="AUTHENTICATION TLV Parameters">

<t>The AUTHENTICATION TLV is the heart of the integrated security mechanism (Prong A) for PTP. 
It provides all necessary data for the processing of the security means. The structure is shown 
in <xref target="tbl_auth_tlv"/> below (compare to Figure 49 of <xref target="IEEE1588-2019"/>).</t>


	<texttable anchor="tbl_auth_tlv" title="Structure of the AUTHENTICATION TLV ">
    <!---   <preamble>(compare to Figure 49 of <xref target="IEEE1588-2019"/>)</preamble>   -->

		<!-- table header:  -->
        <ttcol align="left">Field</ttcol>
        <ttcol align="center">Use</ttcol>
        <ttcol align="left">Description</ttcol>

		<!-- columns:  --> 
		<!-- 1st row:  -->
          <c>tlvType</c>
          <c>mand.</c>
          <c>TLV Type</c>
		<!-- 2nd row:  -->
          <c>lengthField</c>
          <c>mand.</c>
          <c>TLV Length Information</c>
		<!-- 3rd row:  -->
          <c>SPP</c>
          <c>mand.</c>
          <c>Security Parameter Pointer</c>
		<!-- 4th row:  -->
          <c>secParamIndicator</c>
          <c>mand.</c>
          <c>Security Parameter Indicator</c>
		<!-- 5th row:  -->
          <c>keyID</c>
          <c>mand.</c>
          <c>Key Identifier or Current Key Disclosure Interval, depending on verification scheme</c>
		<!-- 6th row:  -->
          <c>disclosedKey</c>
          <c>opt.</c>
          <c>Disclosed key from previous interval</c>
		<!-- 7th row:  -->
          <c>sequenceNo</c>
          <c>opt.</c>
          <c>Sequence number</c>
		<!-- 8th row:  -->
          <c>RES</c>
          <c>opt.</c>
          <c>Reserved</c>
		<!-- 9th row:  -->
          <c>ICV</c>
          <c>mand.</c>
          <c>ICV based on algorithm OID</c>

    <!--      <postamble>which is a very simple example.</postamble>   -->
    </texttable>



<t>The tlvType is AUTHENTICATION and lengthField gives the length of the TLV. When using the 
AUTHENTICATION TLV with NTS key management, the SPP and keyID will be provided by the KE server 
in the PTP Key Grant Message</t>

<t>The optional disclosedKey, sequenceNo, and RES (see discussion in chapter 3) fields are 
omitted. So all of the flags in the SecParamIndicator are FALSE.</t>

<t>ICV field contains the integrity check value of the particular PTP message calculated 
using the integrity algorithm defined by the key management.</t>


</section>




<section anchor="iana-considerations" title="IANA Considerations">

<t>Considerations should be made ...</t>
<t>... </t>

</section>
<section anchor="security-considerations" title="Security Considerations">
<t>... </t>

<t></t>

<t></t>

<t></t>



</section>
<section anchor="acknowledgements" title="Acknowledgements">
<t>The authors would like to thank ...</t>

</section>


  </middle>

  <back>

     <references title='Normative References'>

         &RFC2119;
         &RFC4493;         &RFC4543;         &RFC5116;         &RFC5297;         &RFC7301;         &RFC7525;         &RFC8174;         &RFC8446;         &RFC8915;

    <!-- References 

		IETF RFC 2119 – BCP 14 (1997), “Key words for use in RFCs to Indicate Requirement Levels,” S. Bradner, March 1997.
		IETF RFC 7525 – BCP 195 (2015), “Recommendations for Secure Use of Transport Layer Security (TLS) and Datagram Transport Layer Security (DTLS),” Y. Sheffer, R. Holz, P. Saint-Andre, May 2015.
		IETF RFC 8174 – BCP 14 (2017), “Ambiguity of Uppercase vs. Lowercase in RFC 2119 Key Words,” B. Leiba, May 2017.
		FIPS PUB 198-1
		IEEE Std 1588-2019 
ITU-T Recommendation X.509 (2008), “Information technology – Open systems interconnection – The Directory: Public-key and attribute certificate frameworks”, Nov. 2008. 

    -->

    <reference anchor="IEEE1588-2019" >
         <front>
             <title>IEEE Standard for a Precision Clock Synchronization Protocol for Networked Measurement and Control Systems</title>
             <author >
                 <organization>Institute of Electrical and Electronics Engineers - IEEE Standards Association</organization>
             </author>
             <date year="2019"/>
         </front>
         <seriesInfo name="IEEE" value="Standard 1588-2019"/>
    </reference>
	
    <reference anchor="FIPS-PUB-198-1" >
         <front>
             <title>The Keyed-Hash Message Authentication Code (HMAC)</title>
             <author >
                 <organization>National Institute of Standards and Technology (NIST)</organization>
             </author>
             <date year="2008"/>
         </front>
         <seriesInfo name="NIST" value="FIPS PUB 198-1"/>
    </reference>

    <reference anchor="ITU-T_X.509" >
         <front>
             <title>Information technology – Open systems interconnection – The Directory: Public-key and attribute certificate frameworks</title>
             <author >
                 <organization>International Telecommunication Union (ITU)</organization>
             </author>
             <date month="November" year="2008"/>
         </front>
         <seriesInfo name="ITU-T Recommendation" value="X.509 (2008)"/>
    </reference>

	
    </references>


   <references title='Informative References'>

      <reference anchor="Langer_et_al._2020"
                 target="https://ieeexplore.ieee.org/document/9314809">
        <front>
          <title>A Network Time Security Based Automatic Key Management for PTPv2.1</title>

            <author initials="M" surname="Langer" fullname="Martin Langer">
			   <organization>Mad Dominators, Inc.</organization>
			   </author>
   		    <author initials="K" surname="Heine" fullname="Kai Heine">
			   <organization>Mad Dominators, Inc.</organization>
			   </author>
   		    <author initials="D" surname="Sibold" fullname="Dieter Sibold">
			   <organization>Mad Dominators, Inc.</organization>
			   </author>
   		    <author initials="R" surname="Bermbach" fullname="Rainer Bermbach">
               <organization>Ostfalia University of Applied Sciences</organization>
            </author>

          <date month="November" year="2020"/>
        </front>
		  <seriesInfo name="2020 IEEE 45th Conference on Local Computer Networks (LCN)," value="Sydney, Australia"/>
          <seriesInfo name="DOI" value="10.1109/LCN48667.2020.9314809"/>
      </reference>       

    </references>	
 


  </back>
 
  
</rfc>