<?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 RFC4178 PUBLIC "" "http://xml.resource.org/public/rfc/bibxml/reference.RFC.4178.xml">
<!ENTITY RFC4401 PUBLIC "" "http://xml.resource.org/public/rfc/bibxml/reference.RFC.4401.xml">
<!ENTITY RFC4757 PUBLIC "" "http://xml.resource.org/public/rfc/bibxml/reference.RFC.4757.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-09" 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="14" 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>
    <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_and_Negotiation">
	<t>The SAnon mechanism is identified by the following OID:</t>
	<figure><artwork>
    sanon-x25519 OBJECT IDENTIFIER ::=
        {iso(1)identified-organization(3)dod(6)internet(1)
         private(4)enterprise(1)padl(5322)gss-sanon(26)
         mechanisms(1)sanon-x25519(110)}</artwork></figure>
        <t>The means of discovering GSS-API peers and their supported mechanisms is out of this specification's scope. To avoid multiple layers of negotiation, SAnon is not crypto-agile. A future variant using a different key exchange algorithm would be assigned a different 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">
      <section title="Name Types" anchor="subsec_Name_Types">
	<t>The SAnon mechanism can import a variety of name types. A SAnon mechanism name is logically a boolean indicating whether it represents an anonymous identity. However SAnon SHOULD preserve the name type and string so that names round-trip through GSS_Export_name() and GSS_Import_name().</t>
	<t>The following table indicates which names represent anonymous identities:</t>
	<texttable>
	  <ttcol>Name type</ttcol>
	  <ttcol>Name string</ttcol>
	  <ttcol>Anon</ttcol>
	  <c>GSS_C_NT_USER_NAME</c>
	  <c>WELLKNOWN/ANONYMOUS@WELLKNOWN:ANONYMOUS</c>
	  <c>Y</c>
	  <c>GSS_C_NT_HOSTBASED_SERVICE</c>
	  <c>WELLKNOWN@ANONYMOUS</c>
	  <c>Y</c>
	  <c>GSS_C_NT_DOMAINBASED_SERVICE (see <xref target="RFC5179"/>)</c>
	  <c>WELLKNOWN@ANONYMOUS@ prefix</c>
	  <c>Y</c>
	  <c>GSS_C_NT_ANONYMOUS</c>
	  <c>Any name string</c>
	  <c>Y</c>
	  <c>Any other name type</c>
	  <c>Any name string</c>
	  <c>N</c>
	</texttable>
      </section>
      <section title="Canonicalization" anchor="subsec_Canonicalization">
        <t>The canonical form of the anonymous name has the display string WELLKNOWN/ANONYMOUS@WELLKNOWN:ANONYMOUS <xref target="RFC8062"/> and the GSS_C_NT_ANONYMOUS name type. This is the name observed by a SAnon peer: GSS_Inquire_context() on an established context MUST return this name for both parties.</t>
	<t>GSS_Canonicalize_name() SHOULD transform names representing anonymous identities to this name.</t>
      </section>
      <section title="Exported Name Format" anchor="subsec_Exported_Name_Format">
	<t>SAnon uses the mechanism-independent exported name object format defined in <xref target="RFC2743"/> Section 3.2. All lengths are encoded as big-endian integers.</t>
	<texttable>
	  <ttcol>Length</ttcol>
	  <ttcol>Name</ttcol>
	  <ttcol>Description</ttcol>
	  <c>2</c>
	  <c>TOK_ID</c>
	  <c>04 01</c>
	  <c>2</c>
	  <c>MECH_OID_LEN</c>
	  <c>Length of the mechanism OID</c>
	  <c>MECH_OID_LEN</c>
	  <c>MECH_OID</c>
	  <c>The SAnon mechanism OID, in DER</c>
	  <c>4</c>
	  <c>NAME_LEN</c>
	  <c>Length of the remaining fields</c>
	  <c>2</c>
	  <c>NAME_TYPE_LEN</c>
	  <c>Length of the exported name type</c>
	  <c>NAME_TYPE_LEN</c>
	  <c>NAME_TYPE</c>
	  <c>Name type OID, in DER</c>
	  <c>4</c>
	  <c>NAME_STRING_LEN</c>
	  <c>Length of the exported name string</c>
	  <c>NAME_STRING_LEN</c>
	  <c>NAME_STRING</c>
	  <c>Exported name string</c>
	</texttable>
      </section>
    </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 -- 1.3.6.1.4.1.5322.26.1.110
    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)</t>
	  <t>The claimant_cred_handle identity is anonymous (see  <xref target="subsec_Name_Types"/>)</t>
	  <t>The claimant_cred_handle is the default credential and targ_name is anonymous</t>
	</list>
	If none of the above are the case, the call MUST fail with GSS_S_UNAVAILABLE. (Unlike some other mechanisms, SAnon does not require GSS_C_ANON_FLAG be set to request anonymous authentication.)</t>
<t>If proceeding, the initiator generates a fresh secret and public key pair per <xref target="RFC7748"/> Section 6.1 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. The context 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 canonical 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 context session key per <xref target="sec_Key_derivation"/>.</t>
	  <t>The initiator calls GSS_VerifyMIC() with the MIC extracted from the context token 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. Supported security context flags are as for the acceptor context. The flags returned to the caller are the intersection of supported and requested flags, combined with anon_state (GSS_C_ANON_FLAG) which is set unconditionally.</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 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>
    <section title="Key derivation" anchor="sec_Key_derivation">
      <t>The context session key is known as the base key, and is computed using a key derivation function from <xref target="SP800-108"/> Section 5.1 (using HMAC as the PRF):</t>
      <figure><artwork>    base key = HMAC-SHA-256(K1, i | label | 0x00 | context | L)</artwork></figure>
      <t>where:</t>
      <t><list style="hanging" hangIndent="14">
	<t hangText="K1">the output of X25519(local secret key, peer public key) as specified in <xref target="RFC7748"/> Section 6.1</t>
	<t hangText="i">the constant 0x00000001, representing the iteration count expressed in big-endian binary representation of 4 bytes</t>
	<t hangText="label">the string "sanon-x25519" (without quotation marks)</t>
	<t hangText="context">initiator public key | acceptor public key | channel binding application data (if present)</t>
	<t hangText="L">the constant 0x00000080, being length in bits of the key to be outputted expressed in big-endian binary representation of 4 bytes</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>The base key provides the acceptor-asserted subkey defined in <xref target="RFC4121"/> Section 2 and is used to generate keys for per-message tokens and the GSS-API PRF. Its encryption type is aes128-cts-hmac-sha256-128 per <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 base key for both GSS_C_PRF_KEY_FULL and GSS_C_PRF_KEY_PARTIAL usages.</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>
      <t>The anonymous identity is not a unary one: implementations MUST ensure that GSS_Compare_name() does not compare two anonymous names as being identical (see <xref target="RFC2743"/> Section 2.4.3). This caution applies also to non-anonymous names if the implementation does not support round-tripping of imported export names.</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;
	&RFC7748;
	&RFC8009;
</references>
<references title="Informative References">
	<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>
	&NegoEx;
	&RFC4178;
	&RFC4757;
	&RFC5179;
	&RFC5587;
	&RFC8062;
</references>
    <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="base 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="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="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 GSS-API PRF (see <xref target="sec_Pseudo_Random_Function"/>), with the input data "sanon-x25519-initiator-negoex-key" and "sanon-x25519-acceptor-negoex-key" respectively (without quotation marks).</t>
      <t>The initiator metadata, if present, contains a set of GSS-API flags encoded as a 4 byte little endian integer. This is used to convey to the acceptor any Windows-specific GSS-API flags (see <xref target="RFC4757"/> Section 7.1). Other GSS-API flags MUST NOT be present in the metadata.</t>
      <t>If the GSS-API implementation supports both SPNEGO <xref target="RFC4178"/> and NegoEx, SAnon SHOULD be advertised by both to maximise interoperability.</t>
    </section>
  </back>
</rfc>
