identity 1.0 documentation

JSON Web Key (JWK)

«  JSON Web Encryption (JWE)   ::   Contents   ::   JSON Web Algorithms (JWA)  »

JSON Web Key (JWK)

Abstract

A JSON Web Key (JWK) is a JSON data structure that represents a set of public keys.

Requirements Language

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 RFC 2119 [RFC2119].

Status of this Memo

This Internet-Draft is submitted in full conformance with the provisions of BCP 78 and BCP 79.

Internet-Drafts are working documents of the Internet Engineering Task Force (IETF). Note that other groups may also distribute working documents as Internet-Drafts. The list of current Internet-Drafts is at http://datatracker.ietf.org/drafts/current/.

Internet-Drafts are draft documents valid for a maximum of six months and may be updated, replaced, or obsoleted by other documents at any time. It is inappropriate to use Internet-Drafts as reference material or to cite them other than as “work in progress.”

This Internet-Draft will expire on June 15, 2012.

1. Introduction

A JSON Web Key (JWK) is a JSON data structure that represents a set of public keys as a JSON object [RFC4627].

The JWK format is used to represent bare keys; representing certificate chains is an explicit non-goal of this specification.

JSON Web Keys are referenced in JSON Web Signature (JWS) [JWS] using the jku (JSON Key URL) header parameter and in JSON Web Encryption (JWE) [JWE] using the jku (JSON Key URL) and epk (Ephemeral Public Key) header parameters.

(00 http://self-issued.info/docs/draft-ietf-jose-json-web-key-00.html#anchor1 )

Spec Claim Name
JWS jwu
JWE jku / epk

2. Terminology

JSON Web Key
JWK
A JSON data structure that represents a public key.
JSON Web Key Set
JWK Set
JSON object that contains an array of JWKs as a member.
Base64url Encoding
The URL- and filename-safe Base64 encoding described in RFC 4648 [RFC4648], Section 5, with the (non URL- safe) ‘=’ padding characters omitted, as permitted by Section 3.2. (See Appendix C of [JWS] for notes on implementing base64url encoding without padding.)
Collision Resistant Namespace
A namespace that allows names to be allocated in a manner such that they are highly unlikely to collide with other names. For instance, collision resistance can be achieved through administrative delegation of portions of the namespace or through use of collision-resistant name allocation functions. Examples of Collision Resistant Namespaces include: Domain Names, Object Identifiers (OIDs) as defined in the ITU-T X.660 and X.670 Recommendation series, and Universally Unique IDentifiers (UUIDs) [RFC4122]. When using an administratively delegated namespace, the definer of a name needs to take reasonable precautions to ensure they are in control of the portion of the namespace they use to define the name.

(draft 05 , http://tools.ietf.org/html/draft-ietf-jose-json-web-key-05#section-2 )

3. JSON Web Key (JWK) Format

A JSON Web Key (JWK) is a JSON object containing specific members, as specified below. Those members that are common to all key types are defined below.

In addition to the common parameters, each JWK will have members that are specific to the kind of key being represented. These members represent the parameters of the key. Section 5 of the JSON Web Algorithms (JWA) [JWA] specification defines multiple kinds of cryptographic keys and their associated members.

The member names within a JWK MUST be unique; objects with duplicate member names MUST be rejected.

Additional members MAY be present in the JWK. If not understood by implementations encountering them, they MUST be ignored. Member names used for representing key parameters for different kinds of keys need not be distinct. Any new member name SHOULD either be registered in the IANA JSON Web Key Parameters registry Section 7.1 or be a value that contains a Collision Resistant Namespace.

( http://tools.ietf.org/html/draft-ietf-jose-json-web-key-11#section-3 )

3.1. “kty” (Key Type) Parameter

The “kty” (key type) member identifies the cryptographic algorithm family used with the key. “kty” values SHOULD either be registered in the IANA JSON Web Key Types registry [JWA] or be a value that contains a Collision Resistant Namespace. The “kty” value is a case sensitive string. Use of this member is REQUIRED.

A list of defined “kty” values can be found in the IANA JSON Web Key Types registry [JWA]; the initial contents of this registry are the values defined in Section 5.1 of the JSON Web Algorithms (JWA) [JWA] specification.

Additional members used with these “kty” values can be found in the IANA JSON Web Key Parameters registry Section 7.1; the initial contents of this registry are the values defined in Sections 5.2 and 5.3 of the JSON Web Algorithms (JWA) [JWA] specification.

( http://tools.ietf.org/html/draft-ietf-jose-json-web-key-11#section-3.1 )

3.2. “use” (Key Use) Parameter

The “use” (key use) member identifies the intended use of the key. Values defined by this specification are:

  • “sig” (signature or MAC operation)
  • “enc” (encryption)

Other values MAY be used. The “use” value is a case sensitive string. Use of this member is OPTIONAL.

( http://tools.ietf.org/html/draft-ietf-jose-json-web-key-11#section-3.2 )

3.3. “alg” (Algorithm) Parameter

The “alg” (algorithm) member identifies the algorithm intended for use with the key. The values used in this field are the same as those used in the JWS [JWS] and JWE [JWE] “alg” and “enc” header parameters; these values can be found in the JSON Web Signature and Encryption Algorithms registry [JWA]. Use of this member is OPTIONAL.

( http://tools.ietf.org/html/draft-ietf-jose-json-web-key-11#section-3.3 )

3.4. “kid” (Key ID) Parameter

The “kid” (key ID) member can be used to match a specific key. This can be used, for instance, to choose among a set of keys within a JWK Set during key rollover. The interpretation of the “kid” value is unspecified. When “kid” values are used within a JWK Set, different keys within the JWK Set SHOULD use distinct “kid” values. The “kid” value is a case sensitive string. Use of this member is OPTIONAL.

When used with JWS or JWE, the “kid” value can be used to match a JWS or JWE “kid” header parameter value.

( http://tools.ietf.org/html/draft-ietf-jose-json-web-key-11#section-3.4 )

3.5. “x5u” (X.509 URL) Header Parameter

The “x5u” (X.509 URL) member is a URI [RFC3986] that refers to a resource for an X.509 public key certificate or certificate chain [RFC5280]. The identified resource MUST provide a representation of the certificate or certificate chain that conforms to RFC 5280 [RFC5280] in PEM encoded form [RFC1421]. The key in the first certificate MUST match the bare public key represented by other members of the JWK. The protocol used to acquire the resource MUST provide integrity protection; an HTTP GET request to retrieve the certificate MUST use TLS [RFC2818] [RFC5246]; the identity of the server MUST be validated, as per Section 3.1 of HTTP Over TLS [RFC2818]. Use of this member is OPTIONAL.

http://tools.ietf.org/html/draft-ietf-jose-json-web-key-11#section-3.5

3.6. “x5t” (X.509 Certificate Thumbprint) Header Parameter

The “x5t” (X.509 Certificate Thumbprint) member is a base64url encoded SHA-1 thumbprint (a.k.a. digest) of the DER encoding of an X.509 certificate [RFC5280]. The key in the certificate MUST match the bare public key represented by other members of the JWK. Use of this member is OPTIONAL.

( http://tools.ietf.org/html/draft-ietf-jose-json-web-key-11#section-3.6 )

3.7. “x5c” (X.509 Certificate Chain) Parameter

x5c The “x5c” (X.509 Certificate Chain) member contains a chain of
one or more PKIX certificates [RFC5280]. The certificate chain is represented as a JSON array of certificate value strings. Each string in the array is a base64 encoded ([RFC4648] Section 4 – not base64url encoded) DER [ITU.X690.1994] PKIX certificate value. The PKIX certificate containing the key value MUST be the first certificate. This MAY be followed by additional certificates, with each subsequent certificate being the one used to certify the previous one. The key in the first certificate MUST match the bare public key represented by other members of the JWK. Use of this member is OPTIONAL.

( http://tools.ietf.org/html/draft-ietf-jose-json-web-key-11#section-3.7 )

4. JSON Web Key Set (JWK Set) Format

A JSON Web Key Set (JWK Set) is a JSON object that contains an array of JSON Web Key values as the value of its “keys” member.

The member names within a JWK Set MUST be unique; objects with duplicate member names MUST be rejected.

Additional members MAY be present in the JWK Set. If not understood by implementations encountering them, they MUST be ignored. Parameters for representing additional properties of JWK Sets SHOULD either be registered in the IANA JSON Web Key Set Parameters registry Section 7.2 or be a value that contains a Collision Resistant Namespace.

( http://tools.ietf.org/html/draft-ietf-jose-json-web-key-11#section-4 )

4.1. “keys” (JSON Web Key Set) Parameter

The value of the “keys” (JSON Web Key Set) member is an array of JSON Web Key (JWK) values. Use of this member is REQUIRED.

( http://tools.ietf.org/html/draft-ietf-jose-json-web-key-11#section-4.1 )

5. JSON Web Key Set (JWK Set) Format

A JSON Web Key Set (JWK Set) is a JSON object that contains an array of JSON Web Key values as the value of its “keys” member.

The member names within a JWK Set MUST be unique; objects with duplicate member names MUST be rejected.

Additional members MAY be present in the JWK Set. If present, they MUST be understood by implementations using them. Parameters for representing additional properties of JWK Sets SHOULD either be registered in the IANA JSON Web Key Set Parameters registry Section 6.2

(draft 05 http://tools.ietf.org/html/draft-ietf-jose-json-web-key-05#section-5 )

5.1. “keys” (JSON Web Key Set) Parameter

The value of the “keys” (JSON Web Key Set) member is an array of JSON Web Key (JWK) values. This member is REQUIRED.

(draft 05 http://tools.ietf.org/html/draft-ietf-jose-json-web-key-05#section-5.1 )

6. IANA Considerations

The following registration procedure is used for all the registries established by this specification.

Values are registered with a Specification Required [RFC5226] after a two week review period on the [TBD]@ietf.org mailing list, on the advice of one or more Designated Experts. However, to allow for the allocation of values prior to publication, the Designated Expert(s) may approve registration once they are satisfied that such a specification will be published.

Registration requests must be sent to the [TBD]@ietf.org mailing list for review and comment, with an appropriate subject (e.g., “Request for access token type: example”). [[ Note to RFC-EDITOR: The name of the mailing list should be determined in consultation with the IESG and IANA. Suggested name: jose-reg-review. ]]

Within the review period, the Designated Expert(s) will either approve or deny the registration request, communicating this decision to the review list and IANA. Denials should include an explanation and, if applicable, suggestions as to how to make the request successful.

IANA must only accept registry updates from the Designated Expert(s), and should direct all requests for registration to the review mailing list.

(draft 06, http://tools.ietf.org/html/draft-ietf-jose-json-web-key-05#section-6 )

6.1. JSON Web Key Parameters Registry

This specification establishes the IANA JSON Web Key Parameters registry for reserved JWK parameter names. The registry records the reserved parameter name and a reference to the specification that defines it. This specification registers the parameter names defined in Section 4.

(draft 06, http://tools.ietf.org/html/draft-ietf-jose-json-web-key-05#section-6.1 )

6.1.1. Registration Template

Parameter Name:
The name requested (e.g., “example”). This name is case sensitive. Names that match other registered names in a case insensitive manner SHOULD NOT be accepted.
Change Controller:
For standards-track RFCs, state “IETF”. For others, give the name of the responsible party. Other details (e.g., postal address, e-mail address, home page URI) may also be included.
Specification Document(s):
Reference to the document that specifies the parameter, preferably including a URI that can be used to retrieve a copy of the document. An indication of the relevant sections may also be included, but is not required.

(draft 06, http://tools.ietf.org/html/draft-ietf-jose-json-web-key-05#section-6.1.1 )

6.1.2. Initial Registry Contents

  • Parameter Name: “alg”
  • Change Controller: IETF
  • Specification Document(s): Section 4.1 of [[ this document ]]
  • Parameter Name: “use”
  • Change Controller: IETF
  • Specification Document(s): Section 4.2 of [[ this document ]]
  • Parameter Name: “kid”
  • Change Controller: IETF
  • Specification Document(s): Section 4.3 of [[ this document ]]

(draft 06, http://tools.ietf.org/html/draft-ietf-jose-json-web-key-05#section-6.1.2 )

6.2. JSON Web Key Set Parameters Registry

This specification establishes the IANA JSON Web Key Set Parameters registry for reserved JWK Set parameter names. The registry records the reserved parameter name and a reference to the specification that defines it. This specification registers the parameter names defined in Section 5.

(draft 05, http://tools.ietf.org/html/draft-ietf-jose-json-web-key-05#section-6.2 )

6.2.1. Registration Template

Parameter Name:
The name requested (e.g., “example”). This name is case sensitive. Names that match other registered names in a case insensitive manner SHOULD NOT be accepted.
Change Controller:
For standards-track RFCs, state “IETF”. For others, give the name of the responsible party. Other details (e.g., postal address, e-mail address, home page URI) may also be included.
Specification Document(s):
Reference to the document that specifies the parameter, preferably including a URI that can be used to retrieve a copy of the document. An indication of the relevant sections may also be included, but is not required.

(draft 06, http://tools.ietf.org/html/draft-ietf-jose-json-web-key-06#section-6.2 )

6.2.2. Initial Registry Contents

  • Parameter Name: “keys”
  • Change Controller: IETF
  • Specification Document(s): Section 5.1 of [[ this document ]]

(draft 06, http://tools.ietf.org/html/draft-ietf-jose-json-web-key-06#section-6.2.2 )

7. Security Considerations

All of the security issues faced by any cryptographic application must be faced by a JWS/JWE/JWK agent. Among these issues are protecting the user’s private key, preventing various attacks, and helping the user avoid mistakes such as inadvertently encrypting a message for the wrong recipient. The entire list of security considerations is beyond the scope of this document, but some significant concerns are listed here.

A key is no more trustworthy than the method by which it was received.

Per Section 4.3, applications should not assume that “kid” values are unique within a JWK Set.

Note

  • kid uniquness MUST be checked.

The security considerations in XML DSIG 2.0 [W3C.CR-xmldsig-core2-20120124] , about public key representations also apply to this specification, other than those that are XML specific.

(draft 06, http://tools.ietf.org/html/draft-ietf-jose-json-web-key-06#section-7 )

8. References

8.1. Normative References

[JWA]
Jones, M., “JSON Web Algorithms (JWA)”, October 2012.
[RFC2119]
Bradner, S., “Key words for use in RFCs to Indicate Requirement Levels”, BCP 14, RFC 2119, March 1997.
[RFC4627]
Crockford, D., “The application/json Media Type for JavaScript Object Notation (JSON)”, RFC 4627, July 2006.
[RFC4648]
Josefsson, S., “The Base16, Base32, and Base64 Data Encodings”, RFC 4648, October 2006.
[RFC5226]
Narten, T. and H. Alvestrand, “Guidelines for Writing an IANA Considerations Section in RFCs”, BCP 26, RFC 5226, May 2008.
[W3C.CR-xmldsig-core2-20120124]
Roessler, T., Yiu, K., Solo, D., Reagle, J., Datta, P., Eastlake, D., Hirsch, F., and S. Cantor, “XML Signature Syntax and Processing Version 2.0”, World Wide Web Consortium CR CR-xmldsig-core2-20120124, January 2012, <http://www.w3.org/TR/2012/CR-xmldsig-core2-20120124>.

(draft 06, http://tools.ietf.org/html/draft-ietf-jose-json-web-key-06#section-8.1 )

8.2. Informative References

[JWE]
Jones, M., Rescorla, E., and J. Hildebrand, “JSON Web Encryption (JWE)”, October 2012.
[JWS]
Jones, M., Bradley, J., and N. Sakimura, “JSON Web Signature (JWS)”, October 2012.
[MagicSignatures]
Panzer (editor), J., Laurie, B., and D. Balfanz, “Magic Signatures”, January 2011.
[RFC4122]
Leach, P., Mealling, M., and R. Salz, “A Universally Unique IDentifier (UUID) URN Namespace”, RFC 4122, July 2005.

( draft 06, http://tools.ietf.org/html/draft-ietf-jose-json-web-key-06#section-8.2 )

Appendix A. Example JSON Web Key Sets

A.1. Example Public Keys

The following example JWK Set contains two public keys represented as JWKs: one using an Elliptic Curve algorithm and a second one using an RSA algorithm. The first specifies that the key is to be used for encryption. The second specifies that the key is to be used with the “RS256” algorithm. Both provide a Key ID for key matching purposes. In both cases, integers are represented using the base64url encoding of their big endian representations. (Long lines are broken are for display purposes only.)

{"keys":
  [
    {"kty":"EC",
     "crv":"P-256",
     "x":"MKBCTNIcKUSDii11ySs3526iDZ8AiTo7Tu6KPAqv7D4",
     "y":"4Etl6SRW2YiLUrN5vfvVHuhp7x8PxltmWWlbbM4IFyM",
     "use":"enc",
     "kid":"1"},

    {"kty":"RSA",
     "n": "0vx7agoebGcQSuuPiLJXZptN9nndrQmbXEps2aiAFbWhM78LhWx
4cbbfAAtVT86zwu1RK7aPFFxuhDR1L6tSoc_BJECPebWKRXjBZCiFV4n3oknjhMs
tn64tZ_2W-5JsGY4Hc5n9yBXArwl93lqt7_RN5w6Cf0h4QyQ5v-65YGjQR0_FDW2
QvzqY368QQMicAtaSqzs8KJZgnYb9c7d0zgdAZHzu6qMQvRL5hajrn1n91CbOpbI
SD08qNLyrdkt-bFTWhAI4vMQFh6WeZu0fM4lFd2NcRwr3XPksINHaQ-G_xBniIqb
w0Ls1jF44-csFCur-kEgU8awapJzKnqDKgw",
     "e":"AQAB",
     "alg":"RS256",
     "kid":"2011-04-29"}
  ]
}

( http://tools.ietf.org/html/draft-ietf-jose-json-web-key-11#appendix-A.1 )

A.2. Example Private Keys

The following example JWK Set contains two keys represented as JWKs containing both public and private key values: one using an Elliptic Curve algorithm and a second one using an RSA algorithm. This example extends the example in the previous section, adding private key values. (Line breaks are for display purposes only.)

{"keys":
  [
    {"kty":"EC",
     "crv":"P-256",
     "x":"MKBCTNIcKUSDii11ySs3526iDZ8AiTo7Tu6KPAqv7D4",
     "y":"4Etl6SRW2YiLUrN5vfvVHuhp7x8PxltmWWlbbM4IFyM",
     "d":"870MB6gfuTJ4HtUnUvYMyJpr5eUZNP4Bk43bVdj3eAE",
     "use":"enc",
     "kid":"1"},

    {"kty":"RSA",
     "n":"0vx7agoebGcQSuuPiLJXZptN9nndrQmbXEps2aiAFbWhM78LhWx4
cbbfAAtVT86zwu1RK7aPFFxuhDR1L6tSoc_BJECPebWKRXjBZCiFV4n3oknjhMst
n64tZ_2W-5JsGY4Hc5n9yBXArwl93lqt7_RN5w6Cf0h4QyQ5v-65YGjQR0_FDW2Q
vzqY368QQMicAtaSqzs8KJZgnYb9c7d0zgdAZHzu6qMQvRL5hajrn1n91CbOpbIS
D08qNLyrdkt-bFTWhAI4vMQFh6WeZu0fM4lFd2NcRwr3XPksINHaQ-G_xBniIqbw
0Ls1jF44-csFCur-kEgU8awapJzKnqDKgw",
     "e":"AQAB",
     "d":"X4cTteJY_gn4FYPsXB8rdXix5vwsg1FLN5E3EaG6RJoVH-HLLKD9
M7dx5oo7GURknchnrRweUkC7hT5fJLM0WbFAKNLWY2vv7B6NqXSzUvxT0_YSfqij
w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LSe3SPmRfKwZI6yU24ZxvQKFYItdldUKGzO6Ia6zTKhAVRU",
     "alg":"RS256",
     "kid":"2011-04-29"}
  ]
}

( http://tools.ietf.org/html/draft-ietf-jose-json-web-key-11#appendix-A.2 )

«  JSON Web Encryption (JWE)   ::   Contents   ::   JSON Web Algorithms (JWA)  »