<?xml version="1.0" encoding="UTF-8"?>
<?rfc toc="yes"?>
<?rfc symrefs="yes"?>
<?rfc tocindent="no"?>
<?rfc toc="yes"?>
<?rfc symrefs="yes"?>
<?rfc tocindent="no"?>
<?rfc comments="yes"?>
<?rfc inline="yes"?>
<!DOCTYPE rfc SYSTEM "rfc2629.dtd" [
<!ENTITY RFC2119 PUBLIC "" "http://xml.resource.org/public/rfc/bibxml/reference.RFC.2119.xml">
<!ENTITY RFC2743 PUBLIC "" "http://xml.resource.org/public/rfc/bibxml/reference.RFC.2743.xml">
<!ENTITY RFC3961 PUBLIC "" "http://xml.resource.org/public/rfc/bibxml/reference.RFC.3961.xml">
<!ENTITY RFC4121 PUBLIC "" "http://xml.resource.org/public/rfc/bibxml/reference.RFC.4121.xml">
<!ENTITY RFC4401 PUBLIC "" "http://xml.resource.org/public/rfc/bibxml/reference.RFC.4401.xml">
<!ENTITY RFC5179 PUBLIC "" "http://xml.resource.org/public/rfc/bibxml/reference.RFC.5179.xml">
<!ENTITY RFC5587 PUBLIC "" "http://xml.resource.org/public/rfc/bibxml/reference.RFC.5587.xml">
<!ENTITY RFC7748 PUBLIC "" "http://xml.resource.org/public/rfc/bibxml/reference.RFC.7748.xml">
<!ENTITY RFC8009 PUBLIC "" "http://xml.resource.org/public/rfc/bibxml/reference.RFC.8009.xml">
<!ENTITY RFC8062 PUBLIC "" "http://xml.resource.org/public/rfc/bibxml/reference.RFC.8062.xml">
<!ENTITY NegoEx PUBLIC "" "http://xml.resource.org/public/rfc/bibxml3/reference.I-D.zhu-negoex.xml">
]>
<rfc docName="draft-howard-gss-sanon-03" ipr="trust200902" category="info">
  <front>
    <title abbrev="SAnon GSS-API Mechanism">A Simple Anonymous GSS-API Mechanism</title>
    <author initials="L." surname="Howard" fullname="Luke Howard">
      <organization abbrev="PADL">PADL Software Pty Ltd</organization>
      <address>
        <postal>
          <street>PO Box 59</street>
          <city>Central Park</city>
          <region>VIC</region>
          <code>3145</code>
          <country>Australia</country>
        </postal>
        <email>lukeh@padl.com</email>
      </address>
    </author>
    <date day="7" month="April" year="2020"/>
    <area>Security Area
</area>
    <keyword>Internet-Draft</keyword>
    <abstract>
      <t>This document defines protocols, procedures and conventions for a Generic Security Service Application Program Interface (GSS-API) security mechanism that provides key agreement without authentication of either party.</t>
    </abstract>
  </front>
  <middle>
    <section title="Introduction" anchor="sec_Introduction">
      <t>The Generic Security Service Application Program Interface (GSS-API) <xref target="RFC2743"/> provides a framework for authentication and message protection services through a common programming interface.</t>
      <t>The Simple Anonymous mechanism described in this document (hereafter SAnon) is a simple protocol based on the X25519 elliptic curve Diffie–Hellman (ECDH) key agreement scheme defined in <xref target="RFC7748"/>. No authentication of initiator or acceptor is provided. A potential use of SAnon is to provide a degree of privacy when bootstrapping unkeyed entities.</t>
      <section title="Authentication" anchor="subsec_Authentication">
        <t>The GSS-API protocol involves a client, known as the initiator, sending an initial security context token of a chosen GSS-API security mechanism to a peer, known as the acceptor. The two peers subsequently exchange, synchronously, as many security context tokens as necessary to complete the authentication or fail. The specific number of context tokens exchanged varies by security mechanism: in the case of the SAnon mechanism, it is two (i.e. a single round trip). Once authentication is complete, the initiator and acceptor share a security context which can be used for integrity or confidentiality, protecting subsequent application messages.</t>
      </section>
      <section title="Application Services" anchor="subsec_Application_Services">
        <t>GSS-API provides a number of a services to the calling application:</t>
        <t>
          <list style="hanging">
            <t hangText="GSS_Wrap()"> integrity and optional confidentiality for a message</t>
            <t hangText="GSS_GetMIC()"> integrity for a message sent separately</t>
            <t hangText="GSS_Pseudo_random()"> shared key derivation (e.g., for keying external confidentiality and integrity layers)</t>
          </list>
        </t>
        <t>These services are used with security contexts having a shared session key to protect application-layer messages.</t>
      </section>
    </section>
    <section title="Requirements notation" anchor="sec_Requirements">
      <t>The key words "MUST", "MUST NOT", "REQUIRED", "SHALL", "SHALL NOT", "SHOULD", "SHOULD NOT", "RECOMMENDED", "MAY", and "OPTIONAL" in this document are to be interpreted as described in <xref target="RFC2119"/>.</t>
    </section>
    <section title="Discovery and Negotiation" anchor="sec_Discovery">
        <t>The means of discovering GSS-API peers and their supported mechanisms is out of this specification's scope.</t>
	<t>To avoid multiple negotiation layers and implementation complexity, this specification is deliberately not crypto-agile. A future variant using a different key exchange algorithm would be assigned a different mechanism OID.</t>
	<t>If anonymity is not desired then SAnon MUST NOT be used. Either party can test for the presence of GSS_C_ANON_FLAG to check if anonymous authentication was performed.</t>
    </section>
    <section title="Naming" anchor="sec_Naming">
      <t>The GSS-API provides a rich security principal naming model. At its most basic the query forms of names consist of a user-entered/displayable string and a "name-type". Name-types are constants with names prefixed with "GSS_C_NT_" in the GSS-API.</t>
      <section title="GSS Name Types" anchor="subsec_GSS_Name_Types">
        <section title="GSS_C_NT_USER_NAME" anchor="subsubsec_User_Name">
          <t>This name type is supported when the input name string is the well known anonymous name string, WELLKNOWN/ANONYMOUS@WELLKNOWN:ANONYMOUS. In all other cases, importing the name MUST fail.</t>
        </section>
	<section title="GSS_C_NT_HOSTBASED_SERVICE" anchor="subsubsec_Hostbased_Service">
	  <t>This name type identifies a host-based service and is generally used by acceptors. To allow existing applications to work unmodified with SAnon, it is useful to allow anonymous acceptor credentials to be acquired regardless of the service name. (It follows from SAnon not performing mutual authentication that the acceptor identity is meaningless.) When importing a name of this type the name string SHOULD be ignored.</t>
	</section>
	<section title="GSS_C_NT_DOMAINBASED_SERVICE" anchor="subsubsec_Domainbased_Service">
	  <t>The <xref target="RFC5179"/> name type, along with all other acceptor name types, are treated identically to GSS_C_NT_HOSTBASED_SERVICE.</t>
	</section>
        <section title="GSS_C_NT_ANONYMOUS" anchor="subsubsec_Anonymous">
          <t>When importing a name of this type the name string MUST be ignored. Functions that return a name type to the caller MUST always return this name type. The display form is the well known anonymous name string, WELLKNOWN/ANONYMOUS@WELLKNOWN:ANONYMOUS. This is always the name observed by a SAnon peer.</t>
        </section>
      </section>
      <section title="Canonicalization" anchor="subsec_Canonicalization">
        <t>The SAnon GSS-API mechanism has a single anonymous identity, the well known anonymous name. The canonical form is the well known anonymous name string with the GSS_C_NT_ANONYMOUS name type.</t>
      </section>
      <section title="Mechanism Selection Hints" anchor="subsec_Mechanism_Seleciton_Hints">
        <t>Many deployed applications do not have explicit support for anonymous authentication. To ease deployment, we recommend allowing anonymous authentication to be requested by the initiator acquiring a credential with a well known anonymous name. This may allow the end-user to request anonymous authentication directly, without requiring the application be modified to support GSS_C_ANON_FLAG. The well known anonymous name has the same display form as in Kerberos <xref target="RFC8062"/>, allowing acceptors to perform name-based authorization in a mechanism-agnostic manner.</t>
        <t>This approach may, however, disadvantage applications that wish to use GSS_C_ANON_FLAG to select anonymous authentication, as importing a non-anonymous initiator name would fail with this approach. We consider this an acceptable compromise given the limited deployment of GSS_C_ANON_FLAG in existing implementations.</t>
      </section>
    </section>
    <section title="Mechanism Attributes" anchor="sec_Mechanism_Attributes">
      <t>The <xref target="RFC5587"/> mechanism attributes for this mechanism are:
	<list>
	  <t>GSS_C_MA_MECH_CONCRETE</t>
	  <t>GSS_C_MA_ITOK_FRAMED</t>
	  <t>GSS_C_MA_AUTH_INIT_ANON</t>
	  <t>GSS_C_MA_AUTH_TARG_ANON</t>
	  <t>GSS_C_MA_INTEG_PROT</t>
	  <t>GSS_C_MA_CONF_PROT</t>
	  <t>GSS_C_MA_MIC</t>
	  <t>GSS_C_MA_WRAP</t>
	  <t>GSS_C_MA_REPLAY_DET</t>
	  <t>GSS_C_MA_OOS_DET</t>
	  <t>GSS_C_MA_CBINDINGS</t>
	  <t>GSS_C_MA_PFS</t>
	  <t>GSS_C_MA_CTX_TRANS</t>
	</list>
      </t>
    </section>
    <section title="Definitions and Token Formats" anchor="sec_Definitions">
    <section title="Context Establishment Tokens" anchor="subsec_Context_Tokens">
        <section title="Initial context token" anchor="subsubsec_Initial_context_token"><t>The initial context token is framed per Section 1 of <xref target="RFC2743"/>:</t><figure><artwork>GSS-API DEFINITIONS ::=         
     BEGIN
 
     MechType ::= OBJECT IDENTIFIER
     -- representing SAnon mechanism
     GSSAPI-Token ::=
     [APPLICATION 0] IMPLICIT SEQUENCE {
         thisMech MechType,
         innerToken ANY DEFINED BY thisMech
             -- 32 byte initiator public key
     }
     END</artwork></figure>
	<t>On the first call to GSS_Init_sec_context(), the mechanism checks for one of the following:
	<list>
	  <t>The caller set anon_req_flag (GSS_C_ANON_FLAG); or</t>
	  <t>The claimant_cred_handle identity is the well known anonymous name; or</t>
	  <t>The claimant_cred_handle is the default credential and targ_name an anonymous name.</t>
	</list>
	If none of the above are the case, the call MUST fail with GSS_S_UNAVAILABLE.</t>
<t>If proceeding, the initiator generates a fresh secret and public key pair per Section 6.1 of <xref target="RFC7748"/> and returns GSS_S_CONTINUE_NEEDED indicating that a subsequent context token from the acceptor is expected. The innerToken field of the output_token contains the initiator's 32 byte public key.</t>
</section>
        <section title="Acceptor context token" anchor="subsubsec_Acceptor_context_token">
          <t>Upon receiving a context token from the initiator, the acceptor validates that the token is well formed and contains a public key of the requisite length. The acceptor generates a fresh secret and public key pair. A session key is computed as specified in <xref target="sec_Key_derivation"/>.</t>
	  <t>The acceptor constructs an output_token by concatenating its public key with the token emitted by calling GSS_GetMIC() with the default QOP and zero-length octet string. The output token is sent to the initiator without additional framing.</t>
	  <t>The acceptor then returns GSS_S_COMPLETE, setting src_name to the well known anonymous name. The reply_det_state (GSS_C_REPLAY_FLAG), sequence_state (GSS_C_SEQUENCE_FLAG), conf_avail (GSS_C_CONF_FLAG), integ_avail (GSS_C_INTEG_FLAG) and anon_state (GSS_C_ANON_FLAG) security context flags are set to TRUE. The context is ready to use.</t>
        </section>
        <section title="Initiator context completion" anchor="subsubsec_Initiator_context_completion">
          <t>Upon receiving the acceptor context token and verifying it is well formed, the initiator extracts the acceptor's public key (being the first 32 bytes of the input token) and computes the session key per <xref target="sec_Key_derivation"/>. The initiator then calls GSS_VerifyMIC() with the MIC sent by the acceptor and the zero-length octet string. If successful, the initiator returns GSS_S_COMPLETE to the caller, to indicate the initiator is authenticated and the context is ready for use. No output token is emitted. Security context flags are set as for the acceptor context.</t>
        </section>
    </section>
    <section title="Per-Message Tokens" anchor="subsec_Per_Message_Tokens">
      <t>The per-message tokens definitions are imported from <xref target="RFC4121"/> Section 4.2. The base key used to derive specific keys for signing and sealing messages is the session key defined in <xref target="sec_Key_derivation"/>. The <xref target="RFC3961"/> encryption and checksum algorithms use the aes128-cts-hmac-sha256-128 encryption type defined in <xref target="RFC8009"/>. The AcceptorSubkey flag as defined in <xref target="RFC4121"/> Section 4.2.2 MUST be set.</t>
    </section>
    <section title="Context Deletion Tokens" anchor="subsec_Context_Deletion_Tokens">
      <t>Context deletion tokens are empty in this mechanism. The behavior of GSS_Delete_sec_context() <xref target="RFC2743"/> is as specified in <xref target="RFC4121"/> Section 4.3.</t>
    </section>
    <section title="Exported Name Tokens" anchor="subsec_Exported_Name_Tokens">
        <t>The exported name token format for the SAnon GSS-API mechanism is the same as the display form, plus the standard exported name token format header mandated by the GSS-API <xref target="RFC2743"/>.</t>
    </section>
    </section>
    <section title="Key derivation" anchor="sec_Key_derivation">
      <t>The ECDH shared secret k is computed by calling the X25519 function with the local secret key and the peer's public key, as specified in Section 6.1 of <xref target="RFC7748"/>. The context session key (K1) is computed using a key derivation function from Section 5.1 of <xref target="SP800-108"/> with HMAC as the PRF:</t>
      <t><list><t>K1 = HMAC-SHA-256(key, 0x00000001 | label | 0x00 | context | k)</t></list></t>
      <t>where:</t>
      <t><list style="hanging" hangIndent="14">
	<t hangText="k">the ECDH shared secret computed previously</t>
	<t hangText="0x00000001">the iteration count from Section 5.1 of <xref target="SP800-108"/></t>
	<t hangText="label">the string "sanon-x25519" (without quotation marks)</t>
	<t hangText="context">the concatenation of the initiator and acceptor public keys, along with the channel binding application data (if present), in that order</t>
      </list></t>
      <t>The inclusion of channel bindings in the key derivation function means that the acceptor cannot ignore initiator channel bindings; this differs from some other mechanisms.</t>
      <t>This session key is equivalent to the acceptor-asserted subkey defined in <xref target="RFC4121"/> Section 2 and is used as the base key for generating keys for per-message tokens and the GSS-API PRF.</t>
      <t>The session key encryption type is aes128-cts-hmac-sha256-128 as defined in <xref target="RFC8009"/>. The <xref target="RFC3961"/> algorithm protocol parameters are as given in <xref target="RFC8009"/> Section 5.</t>
    </section>
    <section title="Pseudo-Random Function" anchor="sec_Pseudo_Random_Function">
      <t>The <xref target="RFC4401"/> GSS-API pseudo-random function for this mechanism imports the definitions from <xref target="RFC8009"/>, using the context session key as the base key for both GSS_C_PRF_KEY_FULL and GSS_C_PRF_KEY_PARTIAL usages.</t>
    </section>
    <section title="NegoEx" anchor="sec_NegoEx">
      <t>When SAnon is negotiated by <xref target="I-D.zhu-negoex"/>, the authentication scheme identifier is DEE384FF-1086-4E86-BE78-B94170BFD376.</t>
      <t>The initiator and acceptor keys for NegoEx checksum generation and verification are derived using the PRF from the previous section, with the input data "sanon-x25519-initiator-negoex-key" and "sanon-x25519-acceptor-negoex-key" respectively (without quotation marks).</t>
      <t>No NegoEx metadata is specified. Any metadata present MUST be ignored.</t>
    </section>
    <section title="OID Registry" anchor="sec_OID_Registry">
	<t>The mechanism OID for SAnon is 1.3.6.1.4.1.5322.26.1.110.</t>
    </section>
    <section title="Test Vectors" anchor="sec_Test_Vectors">
      <t><list style="hanging" hangIndent="22">
	<t hangText="initiator secret key">69 df cc 04 2b 7a 33 f8 1a 43 fb f0 33 0a b5 3f<vspace/>bc 20 e6 c1 4f f8 26 ce 6a 4d bc 8c 6e e4 2b a9</t>
	<t hangText="initiator public key">d2 1e 3e 58 60 b0 16 6c d1 cb 38 1a aa 89 62 93<vspace/>07 13 ae e1 76 86 93 10 46 57 a7 a1 9c 1d 76 2e</t>
	<t hangText="initiator token">60 2c 06 0a 2b 06 01 04 01 a9 4a 1a 01 6e d2 1e<vspace/>3e 58 60 b0 16 6c d1 cb 38 1a aa 89 62 93 07 13<vspace/>ae e1 76 86 93 10 46 57 a7 a1 9c 1d 76 2e</t>
	<t hangText="acceptor secret key">3e 4f e6 5b ea 85 94 3b 5a a2 b7 83 f6 26 84 1a<vspace/>10 39 d5 d3 6d af 85 aa a1 6f 12 97 57 99 6c ff</t>
	<t hangText="acceptor public key">a8 32 14 9d 58 33 13 ce 1c 55 7b 2b d1 8a e7 a5<vspace/>59 8c a6 4b 02 20 83 5e 16 be 09 ca 2f 90 60 31</t>
	<t hangText="context session key">af f1 8d b7 45 c6 27 cd a8 da d4 9b d7 e7 01 25</t>
	<t hangText="acceptor token">a8 32 14 9d 58 33 13 ce 1c 55 7b 2b d1 8a e7 a5<vspace/>59 8c a6 4b 02 20 83 5e 16 be 09 ca 2f 90 60 31<vspace/>04 04 05 ff ff ff ff ff 00 00 00 00 00 00 00 00<vspace/>45 02 7b a8 15 1c 33 05 22 bb c4 36 84 d2 e1 8c</t>
      </list></t>
    </section>
    <section title="Security Considerations" anchor="sec_Security_Considerations">
      <t>This document defines a GSS-API security mechanism, and therefore deals in security and has security considerations text embedded throughout. This section only addresses security considerations associated with the SAnon mechanism described in this document. It does not address security considerations associated with the GSS-API itself.</t>
      <t>This mechanism provides only for key agreement. It does not authenticate the identity of either party. It MUST not be selected if either party requires identification of its peer.</t>
    </section>
    <section title="Acknowledgements" anchor="sec_Acknowledgements">
	<t>AuriStor, Inc funded the design of this protocol, along with an implementation for the Heimdal GSS-API library.</t>
        <t>Jeffrey Altman, Greg Hudson, Simon Josefsson, and Nicolas Williams provided valuable feedback on this document.</t>
    </section>
  </middle>
  <back>
    <references title="Normative References">&RFC2119;
&RFC2743;
&RFC3961;
&RFC4121;
&RFC4401;
&RFC5179;
&RFC5587;
&RFC7748;
&RFC8009;
&RFC8062;
&NegoEx;
<reference anchor="SP800-108"><front><title>Recommendation for Key Derivation Using Pseudorandom Functions (Revised)</title><author initials="L." surname="Chen" fullname="Lily Chen"><organization>National Institute of Standards and Technology</organization></author><date year="2009" day="1" month="October"/></front><format type="PDF" target="https://nvlpubs.nist.gov/nistpubs/Legacy/SP/nistspecialpublication800-108.pdf"/></reference>
</references>
  </back>
</rfc>
