<?xml version="1.0"?>
<!DOCTYPE rfc SYSTEM "rfc2629.dtd" [
<!ENTITY RFC2119 PUBLIC '' 'http://xml2rfc.ietf.org/public/rfc/bibxml/reference.RFC.2119.xml'>
<!ENTITY RFC4648 PUBLIC '' 'http://xml2rfc.ietf.org/public/rfc/bibxml/reference.RFC.4648.xml'>
<!ENTITY RFC7515 PUBLIC '' 'http://xml2rfc.ietf.org/public/rfc/bibxml/reference.RFC.7515.xml'>
<!ENTITY RFC7516 PUBLIC '' 'http://xml2rfc.ietf.org/public/rfc/bibxml/reference.RFC.7516.xml'>
<!ENTITY RFC7517 PUBLIC '' 'http://xml2rfc.ietf.org/public/rfc/bibxml/reference.RFC.7517.xml'>
<!ENTITY RFC7518 PUBLIC '' 'http://xml2rfc.ietf.org/public/rfc/bibxml/reference.RFC.7518.xml'>
<!ENTITY RFC7638 PUBLIC '' 'http://xml2rfc.ietf.org/public/rfc/bibxml/reference.RFC.7638.xml'>
<!ENTITY RFC7748 PUBLIC '' 'http://xml2rfc.ietf.org/public/rfc/bibxml/reference.RFC.7748.xml'>
<!ENTITY EDDSA PUBLIC '' 'http://xml2rfc.ietf.org/public/rfc/bibxml3/reference.I-D.irtf-cfrg-eddsa.xml'>
]>

<?rfc compact="no"?>
<?rfc toc="yes"?>
<?rfc symrefs="yes"?>

<rfc category="std" ipr="trust200902"
     docName="draft-ietf-jose-cfrg-curves-04">

	<front>

		<title abbrev="CFRG ECDH and signatures in JOSE">
			CFRG ECDH and signatures in JOSE
		</title>

		<author initials="I." surname="Liusvaara"
			fullname="Ilari Liusvaara">
			<organization>Independent</organization>
			<address>
				<email>ilariliusvaara@welho.com</email>
			</address>
		</author>
    
		<date year="2016"/>

		<abstract>
			<t>This document defines how to use the Diffie-Hellman algorithms "X25519" and "X448" as well
			as the signature algorithms "Ed25519" and "Ed448" from the IRTF CFRG elliptic
			curves work in JOSE.</t>
		</abstract>
    
	</front>

	<middle>

		<section anchor="intro" title="Introduction">
			<t>Internet Research Task Force (IRTF) Crypto Forum Research Group (CFRG) selected new
			Diffie-Hellman algorithms ("X25519" and "X448"; <xref target="RFC7748"/>) and
			signature algorithms ("Ed25519" and "Ed448";
			<xref target="I-D.irtf-cfrg-eddsa"/>) for asymmetric key cryptography. This document
			defines how those algorithms are to be used in JOSE in interoperable manner.</t>

			<t>This document defines the conventions to be used in the context of
			<xref target="RFC7515" />, <xref target="RFC7516" /> and <xref target="RFC7517" />.</t>

			<t>While the CFRG also defined two pairs of isogenous elliptic curves that underlie these
			algorithms, these curves are not directly exposed, as the algorithms laid on top are
			sufficient for the purposes of JOSE and are much easier to use. (Trying to apply ECDSA
			to those curves leads to nasty corner-cases and produces odd results.)</t>

			<t>All inputs to and outputs from the the ECDH and signature functions are defined to
			be octet strings, with the exception of outputs of verification function, which are
			booleans.</t>

			<section title="Terminology">
				<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>

				<t>"JWS Signing Input" and "JWS Signature" are defined by
				<xref target="RFC7515" /></t>

				<t>"Key Agreement with Elliptic Curve Diffie-Hellman Ephemeral Static" is defined
				by <xref target="RFC7518" />, section 4.6</t>

				<t>The JOSE key format ("JSON Web Key (JWK)") is defined by <xref target="RFC7517" />,
				and thumbprints for it ("JSON Web Key (JWK) Thumbprint") in
				<xref target="RFC7638" />.</t>
			</section>
		</section>

		<section anchor="okp-keytype" title="Key type &quot;OKP&quot;">
			<t>A new key type (kty) value &quot;OKP&quot; (Octet Key Pair) is defined for public key
			algorithms that use octet strings as private and public keys. It has the following parameters:
			<list style="symbols">
				<t>The parameter "kty" MUST be "OKP".</t>
				<t>The parameter "crv" MUST be present and contain the subtype of the key (from "JSON
				Web Elliptic Curve" registry).</t>
				<t>The parameter "x" MUST be present and contain the public key encoded using
				the base64url <xref target="RFC4648" /> encoding.</t>
				<t>The parameter "d" MUST be present for private keys and contain the private key
				encoded using the base64url encoding. This parameter MUST NOT be present for public
				keys.</t>
			</list>
			Note: Do not assume that there is an underlying elliptic curve, despite the existence of the
			"crv" and "x" parameters. (For instance, this key type could be extended to represent DH
			algorithms based on hyperelliptic surfaces.)
			</t>
			<t>When calculating JWK Thumbprints <xref target="RFC7638" />, the three public key fields are
			included in the hash input lexicographic order: &quot;crv&quot;, &quot;kty&quot;, and
			&quot;x&quot;.</t>
		</section>

		<section anchor="algorithms" title="Algorithms">
			<section title="Signatures">
				<t>For purpose of using EdDSA for signing data using "JSON Web Signature (JWS)"
					(<xref target="RFC7515" />), algorithm "EdDSA" is defined here, to be applied
					as value of "alg" parameter.</t>
				<t>The following key subtypes are defined here for use with EdDSA.</t>

<figure><artwork>
   "crv"             EdDSA Variant
   Ed25519           Ed25519
   Ed448             Ed448
</artwork></figure>
				<t>The key type used with these keys is &quot;OKP&quot; and the algorithm used
					for signing is &quot;EdDSA&quot;. These subtypes MUST NOT be used for
					ECDH-ES.</t>

				<t>The EdDSA variant used is determined by the subtype of the key (Ed25519 for
					&quot;Ed25519&quot; and Ed448 for &quot;Ed448&quot;).</t>
				<section title="Signing">
					<t>Signing for these is preformed by applying the signing algorithm
					defined in <xref target="I-D.irtf-cfrg-eddsa"/> to the private key (as private
					key), public key (as public key) and the JWS Signing Input (as message).
					The resulting signature is the JWS Signature. All inputs and outputs
					are octet strings.</t>
				</section>
				<section title="Verification">
					<t>Verification is performed by applying the verification algorithm
					defined in <xref target="I-D.irtf-cfrg-eddsa"/> to the public key (as public
					key), the JWS Signing Input (as message) and the JWS Signature (as 
					signature). All inputs are octet strings. If the algorithm accepts, the
					signature is valid; otherwise, the signature is invalid.</t>
				</section>
			</section>
			<section anchor="ECDH-ES" title="ECDH-ES">
				<t>The following key subtypes are defined here for purpose of "Key Agreement with
				Elliptic Curve Diffie-Hellman Ephemeral Static" (ECDH-ES).</t>

<figure><artwork>
   "crv"             ECDH Function Applied
   X25519            X25519
   X448              X448
</artwork></figure>

				<t>The key type used with these keys is &quot;OKP&quot;. These subtypes MUST NOT
				be used for signing.</t>

				<t><xref target="RFC7518" /> Section 4.6 defines the ECDH-ES algorithms
				"ECDH-ES+A128KW", "ECDH-ES+A192KW", "ECDH-ES+A256KW" and "ECDH-ES".</t>

				<section title="Performing the ECDH Operation">

					<t>The "x" parameter of the "epk" field is set as follows:</t>

					<t>Apply the appropriate ECDH function to the ephemeral private key (as scalar
					input) and the standard basepoint (as u-coordinate input).
					The base64url encoding of the output is the value for the "x" parameter of
					the "epk" field. All inputs and outputs are octet strings.</t>

					<t>The Z value (raw key agreement output) for key agreement (to be used in
					subsequent KDF as per <xref target="RFC7518" /> section 4.6.2) is determined
					as follows:</t>

					<t>Apply the appropriate ECDH function to the ephemeral private key (as scalar
					input) and receiver public key (as u-coordinate input). The output is the Z
					value. All inputs and outputs are octet strings.</t>
				</section>
			</section>
		</section>

		<section anchor="security" title="Security considerations">
			<t>Security considerations from <xref target="RFC7748"/> and
			<xref target="I-D.irtf-cfrg-eddsa"/> apply here.</t>

			<t>Do not separate key material from information about what key subtype it is for.
			When using keys, check that the algorithm is compatible with the key subtype for the
			key. To do otherwise opens the system up to attacks via mixing up algorithms. It is
			particularly dangerous to mix up signature and MAC algorithms.</t>

			<t>Although for Ed25519 and Ed448, the signature binds the key used for signing, do not
			assume this, as there are many signature algorithms that fail to make such a binding. If
			key-binding is desired, include the key used for signing either inside the JWS protected
			header or the data to sign.</t>

			<t>If key generation or batch signature verification is performed, a well-seeded
			cryptographic random number generator is REQUIRED. Signing and non-batch signature
			verification are deterministic operations and do not need random numbers of any kind.</t>

			<t>The JWA ECDH-ES KDF construction does not mix keys into the final shared secret. While
			in key exchange such could be a bad mistake, here either the receiver public key has to be
			chosen maliciously or the sender has to be malicious in order to cause problems. In
			either case, all security evaporates.</t>

			<t>The nominal security strengths of X25519 and X448 are ~126 and ~223 bits. Therefore,
			using 256-bit symmetric encryption (especially key wrapping and encryption) with X448 is
			RECOMMENDED.</t>
		</section>

		<section anchor="acknowledgements" title="Acknowledgements">
			<t>Thanks to Michael B. Jones for his comments on an initial pre-draft and editorial help.</t>

			<t>Thanks to Matt Miller for some editorial help.</t>
		</section>

		<section anchor="IANA" title="IANA considerations">
			<?rfc subcompact="yes" ?>
			<t>The following is added to the "JSON Web Key Types" registry:</t>
			<t><list style="symbols">
				<t>"kty" Parameter Value: "OKP"</t>
				<t>Key Type Description: Octet string key pairs</t>
				<t>JOSE Implementation Requirements: Optional</t>
				<t>Change Controller: IESG</t>
				<t>Specification Document(s): Section 2 of [RFC-THIS]</t>
			</list><vspace blankLines="1" /></t>

			<t>The following is added to the "JSON Web Key Parameters" registry:</t>
			<t><list style="symbols">
				<t>Parameter Name: "crv"</t>
				<t>Parameter Description: The subtype of keypair</t>
				<t>Parameter Information Class: Public</t>
				<t>Used with "kty" Value(s): "OKP"</t>
				<t>Change Controller: IESG</t>
				<t>Specification Document(s): <xref target="okp-keytype"/> of [RFC-THIS]</t>
			</list></t>

			<t><list style="symbols">
				<t>Parameter Name: "d"</t>
				<t>Parameter Description: The private key</t>
				<t>Parameter Information Class: Private</t>
				<t>Used with "kty" Value(s): "OKP"</t>
				<t>Change Controller: IESG</t>
				<t>Specification Document(s): <xref target="okp-keytype"/> of [RFC-THIS]</t>
			</list></t>

			<t><list style="symbols">
				<t>Parameter Name: "x"</t>
				<t>Parameter Description: The public key</t>
				<t>Parameter Information Class: Public</t>
				<t>Used with "kty" Value(s): "OKP"</t>
				<t>Change Controller: IESG</t>
				<t>Specification Document(s): <xref target="okp-keytype"/> of [RFC-THIS]</t>
			</list><vspace blankLines="1" /></t>

			<t>The following is added to the "JSON Web Signature and Encryption Algorithms" registry:</t>
			<t><list style="symbols">
				<t>Algorithm Name: "EdDSA"</t>
				<t>Algorithm Description: EdDSA signature algorithms</t>
				<t>Algorithm Usage Location(s): "alg"</t>
				<t>JOSE Implementation Requirements: Optional</t>
				<t>Change Controller: IESG</t>
				<t>Specification Document(s): <xref target="algorithms"/> of [RFC-THIS]</t>
				<t>Algorithm Analysis Documents(s): <xref target="I-D.irtf-cfrg-eddsa"/></t>
			</list></t>
			
			<t>The following is added to the "JSON Web Key Elliptic Curve" registry:</t>
			<t><list style="symbols">
				<t>Curve Name: "Ed25519"</t>
				<t>Curve Description: Ed25519 signature algorithm keypairs</t>
				<t>JOSE Implementation Requirements: Optional</t>
				<t>Change Controller: IESG</t>
				<t>Specification Document(s): <xref target="algorithms"/> of [RFC-THIS]</t>
			</list></t>
			
			<t><list style="symbols">
				<t>Curve Name: "Ed448"</t>
				<t>Curve Description: Ed448 signature algorithm keypairs</t>
				<t>JOSE Implementation Requirements: Optional</t>
				<t>Change Controller: IESG</t>
				<t>Specification Document(s): <xref target="algorithms"/> of [RFC-THIS]</t>
			</list></t>

			<t><list style="symbols">
				<t>Curve name: "X25519"</t>
				<t>Curve Description: X25519 function keypairs</t>
				<t>JOSE Implementation Requirements: Optional</t>
				<t>Change Controller: IESG</t>
				<t>Specification Document(s): <xref target="ECDH-ES"/> of [RFC-THIS]</t>
				<t>Analysis Documents(s): <xref target="RFC7748"/></t>
			</list></t>

			<t><list style="symbols">
				<t>Curve Name: "X448"</t>
				<t>Curve Description: X448 function keypairs</t>
				<t>JOSE Implementation Requirements: Optional</t>
				<t>Change Controller: IESG</t>
				<t>Specification Document(s): <xref target="ECDH-ES"/> of [RFC-THIS]</t>
				<t>Analysis Documents(s): <xref target="RFC7748"/></t>
			</list></t>
			<?rfc subcompact="no" ?>
		</section>
	</middle>
	<back>
		<references title="Normative References">

			&RFC2119;
			&RFC4648;
			&RFC7515;
			&RFC7517;
			&RFC7518;
			&RFC7638;
			&RFC7748;
			&EDDSA;

		</references>

		<references title="Informative References">
			&RFC7516;
		</references>

		<section anchor="Examples" title="Examples">
			<t>To the extent possible, the examples use material taken from test vectors of
			<xref target="RFC7748"/> and <xref target="I-D.irtf-cfrg-eddsa"/>.</t>
			<section title="Ed25519 Private Key">
<figure><artwork>
{"kty":"OKP","crv":"Ed25519",
"d":"nWGxne_9WmC6hEr0kuwsxERJxWl7MmkZcDusAxyuf2A"
"x":"11qYAYKxCrfVS_7TyWQHOg7hcvPapiMlrwIaaPcHURo"}
</artwork></figure>
				<t>The hexadecimal dump of private key is:</t>
<figure><artwork>
9d 61 b1 9d ef fd 5a 60 ba 84 4a f4 92 ec 2c c4
44 49 c5 69 7b 32 69 19 70 3b ac 03 1c ae 7f 60
</artwork></figure>
				<t>And of the public key is:</t>
<figure><artwork>
d7 5a 98 01 82 b1 0a b7 d5 4b fe d3 c9 64 07 3a
0e e1 72 f3 da a6 23 25 af 02 1a 68 f7 07 51 1a
</artwork></figure>
			</section>
			<section title="Ed25519 Public Key">
				<t>This is the public parts of the previous private key (which just omits "d"):</t>
<figure><artwork>
{"kty":"OKP","crv":"Ed25519",
"x":"11qYAYKxCrfVS_7TyWQHOg7hcvPapiMlrwIaaPcHURo"}
</artwork></figure>
			</section>
			<section title="JWK Thumbprint Canonicalization">
				<t>The JWK Thumbprint canonicalization of the two above examples (with linebreak
				inserted for formatting reasons) is:</t>
<figure><artwork>
{"crv":"Ed25519","kty":"OKP","x":"11qYAYKxCrfVS_7TyWQHOg7hcvPapiMlrwI
aaPcHURo"}
</artwork></figure>
				<t>Which has the SHA-256 hash (in hexadecimal) of
				90facafea9b1556698540f70c0117a22ea37bd5cf3ed3c47093c1707282b4b89,
				which results in the base64url encoded JWK Thumbprint representation of
				"kPrK_qmxVWaYVA9wwBF6Iuo3vVzz7TxHCTwXBygrS4k".</t>
			</section>
			<section title="Ed25519 Signing">
				<t>The JWS protected header is:</t>
<figure><artwork>
{"alg":"EdDSA"}
</artwork></figure>
				<t>This has the base64url encoding of:</t>
<figure><artwork>
eyJhbGciOiJFZERTQSJ9
</artwork></figure>
				<t>The payload is (text):</t>
<figure><artwork>
Example of Ed25519 signing
</artwork></figure>
				<t>This has the base64url encoding of:</t>
<figure><artwork>
RXhhbXBsZSBvZiBFZDI1NTE5IHNpZ25pbmc
</artwork></figure>
				<t>The JWS signing input is (concatenation of base64url encoding of the (protected)
				header, a dot and base64url encoding of the payload) is:</t>
<figure><artwork>
eyJhbGciOiJFZERTQSJ9.RXhhbXBsZSBvZiBFZDI1NTE5IHNpZ25pbmc
</artwork></figure>
				<t>Applying the Ed25519 signing algorithm using the private key, public key, and the
				JWS signing input yields the signature (hex):</t>
<figure><artwork>
86 0c 98 d2 29 7f 30 60 a3 3f 42 73 96 72 d6 1b
53 cf 3a de fe d3 d3 c6 72 f3 20 dc 02 1b 41 1e
9d 59 b8 62 8d c3 51 e2 48 b8 8b 29 46 8e 0e 41
85 5b 0f b7 d8 3b b1 5b e9 02 bf cc b8 cd 0a 02
</artwork></figure>
				<t>Converting this to base64url yields:</t>
<figure><artwork>
hgyY0il_MGCjP0JzlnLWG1PPOt7-09PGcvMg3AIbQR6dWbhijcNR4ki4iylGjg5BhVsPt
9g7sVvpAr_MuM0KAg
</artwork></figure>
				<t>So the compact serialization of the JWS is (concatenation of signing input, a dot,
				and base64url encoding of the signature):</t>
<figure><artwork>
eyJhbGciOiJFZERTQSJ9.RXhhbXBsZSBvZiBFZDI1NTE5IHNpZ25pbmc.hgyY0il_MGCj
P0JzlnLWG1PPOt7-09PGcvMg3AIbQR6dWbhijcNR4ki4iylGjg5BhVsPt9g7sVvpAr_Mu
M0KAg
</artwork></figure>
			</section>
			<section title="Ed25519 Validation">
				<t>The JWS from above example is:</t>
<figure><artwork>
eyJhbGciOiJFZERTQSJ9.RXhhbXBsZSBvZiBFZDI1NTE5IHNpZ25pbmc.hgyY0il_MGCj
P0JzlnLWG1PPOt7-09PGcvMg3AIbQR6dWbhijcNR4ki4iylGjg5BhVsPt9g7sVvpAr_Mu
M0KAg
</artwork></figure>
				<t>This has 2 dots in it, so it might be valid a JWS. Base64url decoding the protected
				header yields:</t>
<figure><artwork>
{"alg":"EdDSA"}
</artwork></figure>
				<t>So this is an EdDSA signature. Now the key has: "kty":"OKP" and "crv":"Ed25519", so
				the signature is Ed25519 signature.</t>
				<t>The signing input is the part before second dot:</t>
<figure><artwork>
eyJhbGciOiJFZERTQSJ9.RXhhbXBsZSBvZiBFZDI1NTE5IHNpZ25pbmc
</artwork></figure>
				<t>Applying Ed25519 verification algorithm to the public key, JWS signing input and
				the signature yields true. So the signature is valid. The message is the base64url
				decoding of the part between the dots:</t>
<figure><artwork>
Example of Ed25519 Signing
</artwork></figure>
			</section>
			<section title="ECDH-ES with X25519">
				<t>The public key to encrypt to is:</t>
<figure><artwork>
{"kty":"OKP","crv":"X25519","kid":"Bob"
"x":"3p7bfXt9wbTTW2HC7OQ1Nz-DQ8hbeGdNrfx-FG-IK08"}
</artwork></figure>
				<t>The public key from the target key is (hex):</t>
<figure><artwork>
de 9e db 7d 7b 7d c1 b4 d3 5b 61 c2 ec e4 35 37
3f 83 43 c8 5b 78 67 4d ad fc 7e 14 6f 88 2b 4f
</artwork></figure>
				<t>The ephemeral secret happens to be (hex):</t>
<figure><artwork>
77 07 6d 0a 73 18 a5 7d 3c 16 c1 72 51 b2 66 45
df 4c 2f 87 eb c0 99 2a b1 77 fb a5 1d b9 2c 2a
</artwork></figure>
				<t>So the ephemeral public key is X25519(ephkey,G) (hex):</t>
<figure><artwork>
85 20 f0 09 89 30 a7 54 74 8b 7d dc b4 3e f7 5a
0d bf 3a 0d 26 38 1a f4 eb a4 a9 8e aa 9b 4e 6a
</artwork></figure>
				<t>This is represented as the ephemeral public key value:</t>
<figure><artwork>
{"kty":"OKP","crv":"X25519",
"x":"hSDwCYkwp1R0i33ctD73Wg2_Og0mOBr066SpjqqbTmo"}
</artwork></figure>
				<t>So the protected header could, for example, be:</t>
<figure><artwork>
{"alg":"ECDH-ES+A128KW","epk":{"kty":"OKP","crv":"X25519",
"x":"hSDwCYkwp1R0i33ctD73Wg2_Og0mOBr066SpjqqbTmo"},
"enc":"A128GCM","kid":"Bob"}
</artwork></figure>
				<t>And the sender computes as the DH Z value as X25519(ephkey,recv_pub) (hex):</t>
<figure><artwork>
4a 5d 9d 5b a4 ce 2d e1 72 8e 3b f4 80 35 0f 25
e0 7e 21 c9 47 d1 9e 33 76 f0 9b 3c 1e 16 17 42
</artwork></figure>
				<t>The receiver computes as the DH Z value as X25519(seckey,ephkey_pub) (hex):</t>
<figure><artwork>
4a 5d 9d 5b a4 ce 2d e1 72 8e 3b f4 80 35 0f 25
e0 7e 21 c9 47 d1 9e 33 76 f0 9b 3c 1e 16 17 42
</artwork></figure>
				<t>Which is the same as the sender's value (the both sides run this through the KDF
				before using it as a direct encryption key or AES128-KW key).</t>
			</section>
			<section title="ECDH-ES with X448">
				<t>The public key to encrypt to (with linebreak inserted for formatting reasons)
				is:</t>
<figure><artwork>
{"kty":"OKP","crv":"X448","kid":"Dave",
"x":"PreoKbDNIPW8_AtZm2_sz22kYnEHvbDU80W0MCfYuXL8PjT7QjKhPKcG3LV67D2
uB73BxnvzNgk"}
</artwork></figure>
				<t>The public key from target key is (hex):</t>
<figure><artwork>
3e b7 a8 29 b0 cd 20 f5 bc fc 0b 59 9b 6f ec cf
6d a4 62 71 07 bd b0 d4 f3 45 b4 30 27 d8 b9 72
fc 3e 34 fb 42 32 a1 3c a7 06 dc b5 7a ec 3d ae
07 bd c1 c6 7b f3 36 09
</artwork></figure>
				<t>The ephemeral secret happens to be (hex):</t>
<figure><artwork>
9a 8f 49 25 d1 51 9f 57 75 cf 46 b0 4b 58 00 d4
ee 9e e8 ba e8 bc 55 65 d4 98 c2 8d d9 c9 ba f5
74 a9 41 97 44 89 73 91 00 63 82 a6 f1 27 ab 1d
9a c2 d8 c0 a5 98 72 6b
</artwork></figure>
				<t>So the ephemeral public key is X448(ephkey,G) (hex):</t>
<figure><artwork>
9b 08 f7 cc 31 b7 e3 e6 7d 22 d5 ae a1 21 07 4a
27 3b d2 b8 3d e0 9c 63 fa a7 3d 2c 22 c5 d9 bb
c8 36 64 72 41 d9 53 d4 0c 5b 12 da 88 12 0d 53
17 7f 80 e5 32 c4 1f a0
</artwork></figure>
				<t>This is packed into ephemeral public key value (linebreak inserted for formatting
				purposes):</t>
<figure><artwork>
{"kty":"OKP","crv":"X448",
"x":"mwj3zDG34-Z9ItWuoSEHSic70rg94Jxj-qc9LCLF2bvINmRyQdlT1AxbEtqIEg1
TF3-A5TLEH6A"}
</artwork></figure>
				<t>So the protected header could for example be (linebreak inserted for formatting
				purposes):</t>
<figure><artwork>
{"alg":"ECDH-ES+A256KW","epk":{"kty":"OKP","crv":"X448",
"x":"mwj3zDG34-Z9ItWuoSEHSic70rg94Jxj-qc9LCLF2bvINmRyQdlT1AxbEtqIEg1
TF3-A5TLEH6A"},"enc":"A256GCM","kid":"Dave"}
</artwork></figure>
				<t>And the sender computes as the DH Z value as X448(ephkey,recv_pub) (hex):</t>
<figure><artwork>
07 ff f4 18 1a c6 cc 95 ec 1c 16 a9 4a 0f 74 d1
2d a2 32 ce 40 a7 75 52 28 1d 28 2b b6 0c 0b 56
fd 24 64 c3 35 54 39 36 52 1c 24 40 30 85 d5 9a
44 9a 50 37 51 4a 87 9d
</artwork></figure>
				<t>The receiver computes as the DH Z value as X448(seckey,ephkey_pub) (hex):</t>
<figure><artwork>
07 ff f4 18 1a c6 cc 95 ec 1c 16 a9 4a 0f 74 d1
2d a2 32 ce 40 a7 75 52 28 1d 28 2b b6 0c 0b 56
fd 24 64 c3 35 54 39 36 52 1c 24 40 30 85 d5 9a
44 9a 50 37 51 4a 87 9d
</artwork></figure>
				<t>Which is the same as the sender's value (the both sides run this through KDF before
				using as direct encryption key or AES256-KW key).</t>
			</section>
		</section>
	</back>
</rfc>
