HTTP Working Group | A. Backman, Editor |
Internet-Draft | Amazon |
Intended status: Standards Track | J. Richer |
Expires: December 10, 2021 | Bespoke Engineering |
M. Sporny | |
Digital Bazaar | |
June 8, 2021 |
This document describes a mechanism for creating, encoding, and verifying digital signatures or message authentication codes over content within an HTTP message. This mechanism supports use cases where the full HTTP message may not be known to the signer, and where the message may be transformed (e.g., by intermediaries) before reaching the verifier.¶
RFC EDITOR: please remove this section before publication ¶
Discussion of this draft takes place on the HTTP working group mailing list (ietf-http-wg@w3.org), which is archived at https://lists.w3.org/Archives/Public/ietf-http-wg/.¶
Working Group information can be found at https://httpwg.org/; source code and issues list for this draft can be found at https://github.com/httpwg/http-extensions/labels/signatures.¶
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 https://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 December 10, 2021.¶
Copyright (c) 2021 IETF Trust and the persons identified as the document authors. All rights reserved.¶
This document is subject to BCP 78 and the IETF Trust's Legal Provisions Relating to IETF Documents (https://trustee.ietf.org/license-info) in effect on the date of publication of this document. Please review these documents carefully, as they describe your rights and restrictions with respect to this document. Code Components extracted from this document must include Simplified BSD License text as described in Section 4.e of the Trust Legal Provisions and are provided without warranty as described in the Simplified BSD License.¶
Message integrity and authenticity are important security properties that are critical to the secure operation of many HTTP applications. Application developers typically rely on the transport layer to provide these properties, by operating their application over [TLS]. However, TLS only guarantees these properties over a single TLS connection, and the path between client and application may be composed of multiple independent TLS connections (for example, if the application is hosted behind a TLS-terminating gateway or if the client is behind a TLS Inspection appliance). In such cases, TLS cannot guarantee end-to-end message integrity or authenticity between the client and application. Additionally, some operating environments present obstacles that make it impractical to use TLS, or to use features necessary to provide message authenticity. Furthermore, some applications require the binding of an application-level key to the HTTP message, separate from any TLS certificates in use. Consequently, while TLS can meet message integrity and authenticity needs for many HTTP-based applications, it is not a universal solution.¶
This document defines a mechanism for providing end-to-end integrity and authenticity for content within an HTTP message. The mechanism allows applications to create digital signatures or message authentication codes (MACs) over only that content within the message that is meaningful and appropriate for the application. Strict canonicalization rules ensure that the verifier can verify the signature even if the message has been transformed in any of the many ways permitted by HTTP.¶
The mechanism described in this document consists of three parts:¶
HTTP permits and sometimes requires intermediaries to transform messages in a variety of ways. This may result in a recipient receiving a message that is not bitwise equivalent to the message that was originally sent. In such a case, the recipient will be unable to verify a signature over the raw bytes of the sender's HTTP message, as verifying digital signatures or MACs requires both signer and verifier to have the exact same signed content. Since the raw bytes of the message cannot be relied upon as signed content, the signer and verifier must derive the signed content from their respective versions of the message, via a mechanism that is resilient to safe changes that do not alter the meaning of the message.¶
For a variety of reasons, it is impractical to strictly define what constitutes a safe change versus an unsafe one. Applications use HTTP in a wide variety of ways, and may disagree on whether a particular piece of information in a message (e.g., the body, or the Date header field) is relevant. Thus a general purpose solution must provide signers with some degree of control over which message content is signed.¶
HTTP applications may be running in environments that do not provide complete access to or control over HTTP messages (such as a web browser's JavaScript environment), or may be using libraries that abstract away the details of the protocol (such as the Java HTTPClient library). These applications need to be able to generate and verify signatures despite incomplete knowledge of the HTTP message.¶
As mentioned earlier, HTTP explicitly permits and in some cases requires implementations to transform messages in a variety of ways. Implementations are required to tolerate many of these transformations. What follows is a non-normative and non-exhaustive list of transformations that may occur under HTTP, provided as context:¶
Based on the definition of HTTP and the requirements described above, we can identify certain types of transformations that should not prevent signature verification, even when performed on content covered by the signature. The following list describes those transformations:¶
Additionally, all changes to content not covered by the signature are considered safe.¶
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 [RFC2119] [RFC8174] when, and only when, they appear in all capitals, as shown here.¶
The terms "HTTP message", "HTTP request", "HTTP response", absolute-form, absolute-path, "effective request URI", "gateway", "header field", "intermediary", request-target, "sender", and "recipient" are used as defined in [MESSAGING].¶
The term "method" is to be interpreted as defined in Section 4 of [SEMANTICS].¶
For brevity, the term "signature" on its own is used in this document to refer to both digital signatures and keyed MACs. Similarly, the verb "sign" refers to the generation of either a digital signature or keyed MAC over a given input string. The qualified term "digital signature" refers specifically to the output of an asymmetric cryptographic signing operation.¶
In addition to those listed above, this document uses the following terms:¶
The term "Unix time" is defined by [POSIX.1], Section 4.16.¶
HTTP Message Signatures are designed to be a general-purpose security mechanism applicable in a wide variety of circumstances and applications. In order to properly and safely apply HTTP Message Signatures, an application or profile of this specification MUST specify all of the following items:¶
The details of this kind of profiling are the purview of the application and outside the scope of this specification.¶
In order to allow signers and verifiers to establish which content is covered by a signature, this document defines content identifiers for data items covered by an HTTP Message Signature as well as the means for combining these canonicalized values into a signature input string.¶
Some content within HTTP messages can undergo transformations that change the bitwise value without altering meaning of the content (for example, the merging together of header fields with the same name). Message content must therefore be canonicalized before it is signed, to ensure that a signature can be verified despite such intermediary transformations. This document defines rules for each content identifier that transform the identifier's associated content into such a canonical form.¶
Content identifiers are defined using production grammar defined by RFC8941, Section 4 [RFC8941]. The content identifier is an sf-string value. The content identifier type MAY define parameters which are included using the parameters rule.¶
content-identifier = sf-string parameters
Note that this means the value of the identifier itself is encased in double quotes, with parameters following as a semicolon-separated list, such as "cache-control", "date", or "@signature-params".¶
The following sections define content identifier types, their parameters, their associated content, and their canonicalization rules. The method for combining content identifiers into the signature input string is defined in Section 2.4.¶
The content identifier for an HTTP header is the lowercased form of its header field name. While HTTP header field names are case-insensitive, implementations MUST use lowercased field names (e.g., content-type, date, etag) when using them as content identifiers.¶
Unless overridden by additional parameters and rules, the HTTP header field value MUST be canonicalized with the following steps:¶
The resulting string is the canonicalized value.¶
If value of the the HTTP header in question is a structured field ([RFC8941]), the content identifier MAY include the sf parameter. If this parameter is included, the HTTP header value MUST be canonicalized using the rules specified in Section 4 of RFC8941 [RFC8941]. Note that this process will replace any optional whitespace with a single space.¶
The resulting string is used as the field value input in Section 2.1.¶
This section contains non-normative examples of canonicalized values for header fields, given the following example HTTP message:¶
Server: www.example.com Date: Tue, 07 Jun 2014 20:51:35 GMT X-OWS-Header: Leading and trailing whitespace. X-Obs-Fold-Header: Obsolete line folding. X-Empty-Header: Cache-Control: max-age=60 Cache-Control: must-revalidate
The following table shows example canonicalized values for header fields, given that message:¶
Header Field | Canonicalized Value |
---|---|
"cache-control" | max-age=60, must-revalidate |
"date" | Tue, 07 Jun 2014 20:51:35 GMT |
"server" | www.example.com |
"x-empty-header" | |
"x-obs-fold-header" | Obsolete line folding. |
"x-ows-header" | Leading and trailing whitespace. |
An individual member in the value of a Dictionary Structured Field is identified by using the parameter key on the content identifier for the header. The value of this parameter is a the key being identified, without any parameters present on that key in the original dictionary.¶
An individual member in the value of a Dictionary Structured Field is canonicalized by applying the serialization algorithm described in Section 4.1.2 of RFC8941 [RFC8941] on a Dictionary containing only that member.¶
This section contains non-normative examples of canonicalized values for Dictionary Structured Field Members given the following example header field, whose value is assumed to be a Dictionary:¶
X-Dictionary: a=1, b=2;x=1;y=2, c=(a b c)
The following table shows example canonicalized values for different content identifiers, given that field:¶
Content Identifier | Canonicalized Value |
---|---|
"x-dictionary";key=a | 1 |
"x-dictionary";key=b | 2;x=1;y=2 |
"x-dictionary";key=c | (a, b, c) |
Content not found in an HTTP header can be included in the signature base string by defining a content identifier and the canonicalization method for its content.¶
To differentiate specialty content identifiers from HTTP headers, specialty content identifiers MUST start with the "at" @ character. This specification defines the following specialty content identifiers:¶
Additional specialty content identifiers MAY be defined and registered in the HTTP Signatures Specialty Content Identifier Registry. (Section 5.3)¶
The request target endpoint, consisting of the request method and the path and query of the effective request URI, is identified by the @request-target identifier.¶
Its value is canonicalized as follows:¶
The following table contains non-normative example HTTP messages and their canonicalized @request-target values.¶
HTTP Message | @request-target |
---|---|
POST /?param=value HTTP/1.1 Host: www.example.com | post /?param=value |
POST /a/b HTTP/1.1 Host: www.example.com | post /a/b |
GET http://www.example.com/a/ HTTP/1.1 | get /a/ |
GET http://www.example.com HTTP/1.1 | get / |
CONNECT server.example.com:80 HTTP/1.1 Host: server.example.com | connect / |
OPTIONS * HTTP/1.1 Host: server.example.com | options * |
HTTP Message Signatures have metadata properties that provide information regarding the signature's generation and/or verification.¶
The signature parameters specialty content is identified by the @signature-params identifier.¶
Its canonicalized value is the serialization of the signature parameters for this signature, including the covered content list with all associated parameters.¶
Additional parameters can be defined in the HTTP Signature Parameters Registry (Section 5.2.2).¶
The signature parameters are serialized using the rules in Section 4 of RFC8941 [RFC8941] as follows:¶
Note that the inner-list serialization is used for the covered content value instead of the sf-list serialization in order to facilitate this value's additional inclusion in the Signature-Input header's dictionary, as discussed in Section 4.1.¶
This example shows a canonicalized value for the parameters of a given signature:¶
("@request-target" "host" "date" "cache-control" "x-empty-header" \ "x-example");keyid="test-key-rsa-pss";alg="rsa-pss-sha512";\ created=1618884475;expires=1618884775
Note that an HTTP message could contain multiple signatures, but only the signature parameters used for the current signature are included in this field.¶
The signature input is a US-ASCII string containing the content that is covered by the signature. To create the signature input string, the signer or verifier concatenates together entries for each identifier in the signature's covered content and parameters using the following algorithm:¶
If covered content references an identifier that cannot be resolved to a value in the message, the implementation MUST produce an error. Such situations are included but not limited to:¶
In the following non-normative example, the HTTP message being signed is the following request:¶
GET /foo HTTP/1.1 Host: example.org Date: Tue, 20 Apr 2021 02:07:55 GMT X-Example: Example header with some whitespace. X-Empty-Header: Cache-Control: max-age=60 Cache-Control: must-revalidate
The covered content consists of the @request-target specialty content followed by the Host, Date, Cache-Control, X-Empty-Header, X-Example HTTP headers, in order. The signature creation timestamp is 1618884475 and the key identifier is test-key-rsa-pss. The signature input string for this message with these parameters is:¶
"@request-target": get /foo "host": example.org "date": Tue, 20 Apr 2021 02:07:55 GMT "cache-control": max-age=60, must-revalidate "x-empty-header": "x-example": Example header with some whitespace. "@signature-params": ("@request-target" "host" "date" "cache-control" \ "x-empty-header" "x-example");created=1618884475;\ keyid="test-key-rsa-pss"
Figure 1: Non-normative example Signature Input
An HTTP Message Signature is a signature over a string generated from a subset of the content in an HTTP message and metadata about the signature itself. When successfully verified against an HTTP message, it provides cryptographic proof that with respect to the subset of content that was signed, the message is semantically equivalent to the message for which the signature was generated.¶
In order to create a signature, a signer MUST follow the following algorithm:¶
For example, given the HTTP message and signature parameters in the example in Section 2.4, the example signature input string when signed with the test-key-rsa-pss key in Appendix B.1.2 gives the following message signature output value, encoded in Base64:¶
lPxkxqDEPhgrx1yPaKLO7eJ+oPjSwsQ5NjWNRfYP7Jw0FwnK1k8/GH7g5s2q0VTTKVm\ xyfpUDp/HsDphh5Z7Fa/lvtujHyFe/0EP9z7bnVb7YBZrxV52LGvP8p4APhOYuG4yaH\ z478GsJav9BQYK0B2IOHdLFJe8qwWPJs07J47gPewpNwCt0To/zZ2KPpylGX5UHVgJP\ Uom64KjX43u2OwIvSoPEYk4nuBvLR9yxYAHURaTfLoEDUCtY1FsU1hOfG3jAlcT6ill\ fnyS72PEdSSzw1KsxroMj9IYpFhva77YxmJRk4pCIW0F0Kj0ukl7J4y2aZJHMCYI3g8\ yfqh/wQ==
Figure 2: Non-normative example signature value
A verifier processes a signature and its associated signature input parameters in concert with each other.¶
In order to verify a signature, a verifier MUST follow the following algorithm:¶
If any of the above steps fail, the signature validation fails.¶
The verification requirements specified in this document are intended as a baseline set of restrictions that are generally applicable to all use cases. Applications using HTTP Message Signatures MAY impose requirements above and beyond those specified by this document, as appropriate for their use case.¶
Some non-normative examples of additional requirements an application might define are:¶
Application-specific requirements are expected and encouraged. When an application defines additional requirements, it MUST enforce them during the signature verification process, and signature verification MUST fail if the signature does not conform to the application's requirements.¶
Applications MUST enforce the requirements defined in this document. Regardless of use case, applications MUST NOT accept signatures that do not conform to these requirements.¶
HTTP Message signatures MAY use any cryptographic digital signature or MAC method that is appropriate for the key material, environment, and needs of the signer and verifier. All signatures are generated from and verified against the byte values of the signature input string defined in Section 2.4.¶
Each signature algorithm method takes as its input the signature input string as a set of byte values (I), the signing key material (Ks), and outputs the signed content as a set of byte values (S):¶
HTTP_SIGN (I, Ks) -> S
Each verification algorithm method takes as its input the recalculated signature input string as a set of byte values (I), the verification key material (Kv), and the presented signature to be verified as a set of byte values (S) and outputs the verification result (V) as a boolean:¶
HTTP_VERIFY (I, Kv, S) -> V
This section contains several common algorithm methods. The method to use can be communicated through the algorithm signature parameter defined in Section 2.3.2, by reference to the key material, or through mutual agreement between the signer and verifier.¶
To sign using this algorithm, the signer applies the RSASSA-PSS-SIGN (K, M) function [RFC8017] with the signer's private signing key (K) and the signature input string (M) (Section 2.4). The mask generation function is MGF1 as specified in [RFC8017] with a hash function of SHA-512 [RFC6234]. The salt length (sLen) is 64 bytes. The hash function (Hash) SHA-512 [RFC6234] is applied to the signature input string to create the digest content to which the digital signature is applied. The resulting signed content byte array (S) is the HTTP message signature output used in Section 3.1.¶
To verify using this algorithm, the verifier applies the RSASSA-PSS-VERIFY ((n, e), M, S) function [RFC8017] using the public key portion of the verification key material ((n, e)) and the signature input string (M) re-created as described in Section 3.2. The mask generation function is MGF1 as specified in [RFC8017] with a hash function of SHA-512 [RFC6234]. The salt length (sLen) is 64 bytes. The hash function (Hash) SHA-512 [RFC6234] is applied to the signature input string to create the digest content to which the verification function is applied. The verifier extracts the HTTP message signature to be verified (S) as described in Section 3.2. The results of the verification function are compared to the http message signature to determine if the signature presented is valid.¶
To sign using this algorithm, the signer applies the RSASSA-PKCS1-V1_5-SIGN (K, M) function [RFC8017] with the signer's private signing key (K) and the signature input string (M) (Section 2.4). The hash SHA-256 [RFC6234] is applied to the signature input string to create the digest content to which the digital signature is applied. The resulting signed content byte array (S) is the HTTP message signature output used in Section 3.1.¶
To verify using this algorithm, the verifier applies the RSASSA-PKCS1-V1_5-VERIFY ((n, e), M, S) function [RFC8017] using the public key portion of the verification key material ((n, e)) and the signature input string (M) re-created as described in Section 3.2. The hash function SHA-256 [RFC6234] is applied to the signature input string to create the digest content to which the verification function is applied. The verifier extracts the HTTP message signature to be verified (S) as described in Section 3.2. The results of the verification function are compared to the http message signature to determine if the signature presented is valid.¶
To sign and verify using this algorithm, the signer applies the HMAC function [RFC2104] with the shared signing key (K) and the signature input string (text) (Section 2.4). The hash function SHA-256 [RFC6234] is applied to the signature input string to create the digest content to which the HMAC is applied, giving the signature result.¶
For signing, the resulting value is the HTTP message signature output used in Section 3.1.¶
For verification, the verifier extracts the HTTP message signature to be verified (S) as described in Section 3.2. The output of the HMAC function is compared to the value of the HTTP message signature, and the results of the comparison determine the validity of the signature presented.¶
To sign using this algorithm, the signer applies the ECDSA algorithm [FIPS186-4] using curve P-256 with the signer's private signing key and the signature input string (Section 2.4). The hash SHA-256 [RFC6234] is applied to the signature input string to create the digest content to which the digital signature is applied. The resulting signed content byte array is the HTTP message signature output used in Section 3.1.¶
To verify using this algorithm, the verifier applies the ECDSA algorithm [FIPS186-4] using the public key portion of the verification key material and the signature input string re-created as described in Section 3.2. The hash function SHA-256 [RFC6234] is applied to the signature input string to create the digest content to which the verification function is applied. The verifier extracts the HTTP message signature to be verified (S) as described in Section 3.2. The results of the verification function are compared to the http message signature to determine if the signature presented is valid.¶
If the signing algorithm is a JOSE signing algorithm from the JSON Web Signature and Encryption Algorithms Registry established by [RFC7518], the JWS algorithm definition determines the signature and hashing algorithms to apply for both signing and verification. There is no use of the explicit alg signature parameter when using JOSE signing algorithms.¶
For both signing and verification, the HTTP messages signature input string (Section 2.4) is used as the entire "JWS Signing Input". The JOSE Header defined in [RFC7517] is not used, and the signature input string is not first encoded in Base64 before applying the algorithm. The output of the JWS signature is taken as a byte array prior to the Base64url encoding used in JOSE.¶
The JWS algorithm MUST NOT be none and MUST NOT be any algorithm with a JOSE Implementation Requirement of Prohibited.¶
Message signatures can be included within an HTTP message via the Signature-Input and Signature HTTP header fields, both defined within this specification.¶
An HTTP message signature MUST use both headers: the Signature HTTP header field contains the signature value, while the Signature-Input HTTP header field identifies the covered content and parameters that describe how the signature was generated. Each header MAY contain multiple labeled values, where the labels determine the correlation between the Signature and Signature-Input fields.¶
The Signature-Input HTTP header field is a Dictionary Structured Header [RFC8941] containing the metadata for one or more message signatures generated from content within the HTTP message. Each member describes a single message signature. The member's name is an identifier that uniquely identifies the message signature within the context of the HTTP message. The member's value is the serialization of the covered content including all signature metadata parameters, using the serialization process defined in Section 2.3.2.¶
Signature-Input: sig1=("@request-target" "host" "date" \ "cache-control" "x-empty-header" "x-example");created=1618884475\ ;keyid="test-key-rsa-pss"
To facilitate signature validation, the Signature-Input header value MUST contain the same serialized value used in generating the signature input string's @signature-params value.¶
The Signature HTTP header field is a Dictionary Structured Header [RFC8941] containing one or more message signatures generated from content within the HTTP message. Each member's name is a signature identifier that is present as a member name in the Signature-Input Structured Header within the HTTP message. Each member's value is a Byte Sequence containing the signature value for the message signature identified by the member name. Any member in the Signature HTTP header field that does not have a corresponding member in the HTTP message's Signature-Input HTTP header field MUST be ignored.¶
Signature: sig1=:lPxkxqDEPhgrx1yPaKLO7eJ+oPjSwsQ5NjWNRfYP7Jw0FwnK1k\ 8/GH7g5s2q0VTTKVmxyfpUDp/HsDphh5Z7Fa/lvtujHyFe/0EP9z7bnVb7YBZrxV5\ 2LGvP8p4APhOYuG4yaHz478GsJav9BQYK0B2IOHdLFJe8qwWPJs07J47gPewpNwCt\ 0To/zZ2KPpylGX5UHVgJPUom64KjX43u2OwIvSoPEYk4nuBvLR9yxYAHURaTfLoED\ UCtY1FsU1hOfG3jAlcT6illfnyS72PEdSSzw1KsxroMj9IYpFhva77YxmJRk4pCIW\ 0F0Kj0ukl7J4y2aZJHMCYI3g8yfqh/wQ==:
Since Signature-Input and Signature are both defined as Dictionary Structured Headers, they can be used to include multiple signatures within the same HTTP message. For example, a signer may include multiple signatures signing the same content with different keys or algorithms to support verifiers with different capabilities, or a reverse proxy may include information about the client in header fields when forwarding the request to a service host, including a signature over those fields and the client's original signature.¶
The following is a non-normative example of header fields a reverse proxy sets in addition to the examples in the previous sections. The original signature is included under the identifier sig1, and the reverse proxy's signature is included under proxy_sig. The proxy uses the key rsa-test-key to create its signature using the rsa-v1_5-sha256 signature value. This results in a signature input string of:¶
"signature";key="sig1": \ :lPxkxqDEPhgrx1yPaKLO7eJ+oPjSwsQ5NjWNRfYP7Jw0FwnK1k8/GH7g5s2q0VTT\ KVmxyfpUDp/HsDphh5Z7Fa/lvtujHyFe/0EP9z7bnVb7YBZrxV52LGvP8p4APhOYu\ G4yaHz478GsJav9BQYK0B2IOHdLFJe8qwWPJs07J47gPewpNwCt0To/zZ2KPpylGX\ 5UHVgJPUom64KjX43u2OwIvSoPEYk4nuBvLR9yxYAHURaTfLoEDUCtY1FsU1hOfG3\ jAlcT6illfnyS72PEdSSzw1KsxroMj9IYpFhva77YxmJRk4pCIW0F0Kj0ukl7J4y2\ aZJHMCYI3g8yfqh/wQ==: "x-forwarded-for": 192.0.2.123 "@signature-params": ("signature";key="sig1" "x-forwarded-for")\ ;created=1618884480;keyid="test-key-rsa";alg="rsa-v1_5-sha256"
And a signature output value of:¶
XD1O/vEh772WVpY7jYvReXop2+b7xTIIPKH8/OCYzPn78Wd9jodCwAJPF5TYCn9L6n6\ 8j4EjGsqFOMkVLVdSQEZqMLjEbvMEdIe8m1a0CLd5kydeaAwoHoglqod6ijkwhhEtxt\ aD8tDZmihQw2mZEH8u4aMSnRntqy7ExCNld0JLharsHV0iCbRO9jIP+d2ApD7gB+eZp\ n3pIvvVJZlxTwPkahFpxKlQtNMPaSqa1lvejURx+ST8CEuz4sS+G/oLJiX3MZenuUoO\ R8HeOHDnjN/VLzrEN4x44iF7WIL+iY2PtK87LUWRAsJAX9GqHL/upsGh1nxIdoVaoLV\ V5w+fRw==
These values are added to the HTTP request message by the proxy. The different signature values are wrapped onto separate lines to increase human-readability of the result.¶
X-Forwarded-For: 192.0.2.123 Signature-Input: sig1=("@request-target" "host" "date" \ "cache-control" "x-empty-header" "x-example")\ ;created=1618884475;keyid="test-key-rsa-pss", \ proxy_sig=("signature";key="sig1" "x-forwarded-for")\ ;created=1618884480;keyid="test-key-rsa";alg="rsa-v1_5-sha256" Signature: sig1=:lPxkxqDEPhgrx1yPaKLO7eJ+oPjSwsQ5NjWNRfYP7Jw0FwnK1k\ 8/GH7g5s2q0VTTKVmxyfpUDp/HsDphh5Z7Fa/lvtujHyFe/0EP9z7bnVb7YBZrx\ V52LGvP8p4APhOYuG4yaHz478GsJav9BQYK0B2IOHdLFJe8qwWPJs07J47gPewp\ NwCt0To/zZ2KPpylGX5UHVgJPUom64KjX43u2OwIvSoPEYk4nuBvLR9yxYAHURa\ TfLoEDUCtY1FsU1hOfG3jAlcT6illfnyS72PEdSSzw1KsxroMj9IYpFhva77Yxm\ JRk4pCIW0F0Kj0ukl7J4y2aZJHMCYI3g8yfqh/wQ==:, \ proxy_sig=:XD1O/vEh772WVpY7jYvReXop2+b7xTIIPKH8/OCYzPn78Wd9jodCwA\ JPF5TYCn9L6n68j4EjGsqFOMkVLVdSQEZqMLjEbvMEdIe8m1a0CLd5kydeaAwoH\ oglqod6ijkwhhEtxtaD8tDZmihQw2mZEH8u4aMSnRntqy7ExCNld0JLharsHV0i\ CbRO9jIP+d2ApD7gB+eZpn3pIvvVJZlxTwPkahFpxKlQtNMPaSqa1lvejURx+ST\ 8CEuz4sS+G/oLJiX3MZenuUoOR8HeOHDnjN/VLzrEN4x44iF7WIL+iY2PtK87LU\ WRAsJAX9GqHL/upsGh1nxIdoVaoLVV5w+fRw==:
The proxy's signature and the client's original signature can be verified independently for the same message, depending on the needs of the application.¶
This document defines HTTP Signature Algorithms, for which IANA is asked to create and maintain a new registry titled "HTTP Signature Algorithms". Initial values for this registry are given in Section 5.1.2. Future assignments and modifications to existing assignment are to be made through the Expert Review registration policy [RFC8126] and shall follow the template presented in Section 5.1.1.¶
Algorithms referenced by algorithm identifiers have to be fully defined with all parameters fixed. Algorithm identifiers in this registry are to be interpreted as whole string values and not as a combination of parts. That is to say, it is expected that implementors understand rsa-pss-sha512 as referring to one specific algorithm with its hash, mask, and salt values set as defined here. Implementors do not parse out the rsa, pss, and sha512 portions of the identifier to determine parameters of the signing algorithm from the string.¶
This document defines the Signature-Input Structured Header, whose member values may have parameters containing metadata about a message signature. IANA is asked to create and maintain a new registry titled "HTTP Signature Metadata Parameters" to record and maintain the set of parameters defined for use with member values in the Signature-Input Structured Header. Initial values for this registry are given in Section 5.2.2. Future assignments and modifications to existing assignments are to be made through the Expert Review registration policy [RFC8126] and shall follow the template presented in Section 5.2.1.¶
The table below contains the initial contents of the HTTP Signature Metadata Parameters Registry. Each row in the table represents a distinct entry in the registry.¶
Name | Status | Reference(s) |
---|---|---|
alg | Active | Section 2.3.2 of this document |
created | Active | Section 2.3.2 of this document |
expires | Active | Section 2.3.2 of this document |
keyid | Active | Section 2.3.2 of this document |
nonce | Active | Section 2.3.2 of this document |
This document defines a method for canonicalizing HTTP message content, including content that can be generated from the context of the HTTP message outside of the HTTP headers. This content is identified by a unique key. IANA is asked to create and maintain a new registry typed "HTTP Signature Specialty Content Identifiers" to record and maintain the set of non-header content identifiers and their canonicalization method. Initial values for this registry are given in Section 5.3.2. Future assignments and modifications to existing assignments are to be made through the Expert Review registration policy [RFC8126] and shall follow the template presented in Section 5.3.1.¶
The table below contains the initial contents of the HTTP Signature Specialty Content Identifiers Registry.¶
Name | Status | Reference(s) |
---|---|---|
@request-target | Active | Section 2.3.1 of this document |
@signature-params | Active | Section 2.3.2 of this document |
(( TODO: need to dive deeper on this section; not sure how much of what's referenced below is actually applicable, or if it covers everything we need to worry about. ))¶
(( TODO: Should provide some recommendations on how to determine what content needs to be signed for a given use case. ))¶
There are a number of security considerations to take into account when implementing or utilizing this specification. A thorough security analysis of this protocol, including its strengths and weaknesses, can be found in [WP-HTTP-Sig-Audit].¶
There have been many attempts to create signed HTTP messages in the past, including other non-standard definitions of the Signature header used within this specification. It is recommended that developers wishing to support both this specification and other historical drafts do so carefully and deliberately, as incompatibilities between this specification and various versions of other drafts could lead to unexpected problems.¶
It is recommended that implementers first detect and validate the Signature-Input header defined in this specification to detect that this standard is in use and not an alternative. If the Signature-Input header is present, all Signature headers can be parsed and interpreted in the context of this draft.¶
This section provides cryptographic keys that are referenced in example signatures throughout this document. These keys MUST NOT be used for any purpose other than testing.¶
The key identifiers for each key are used throughout the examples in this specification. It is assumed for these examples that the signer and verifier can unambiguously dereference all key identifiers used here, and that the keys and algorithms used are appropriate for the context in which the signature is presented.¶
The following key is a 2048-bit RSA public and private key pair, referred to in this document as test-key-rsa:¶
-----BEGIN RSA PUBLIC KEY----- MIIBCgKCAQEAhAKYdtoeoy8zcAcR874L8cnZxKzAGwd7v36APp7Pv6Q2jdsPBRrw WEBnez6d0UDKDwGbc6nxfEXAy5mbhgajzrw3MOEt8uA5txSKobBpKDeBLOsdJKFq MGmXCQvEG7YemcxDTRPxAleIAgYYRjTSd/QBwVW9OwNFhekro3RtlinV0a75jfZg kne/YiktSvLG34lw2zqXBDTC5NHROUqGTlML4PlNZS5Ri2U4aCNx2rUPRcKIlE0P uKxI4T+HIaFpv8+rdV6eUgOrB2xeI1dSFFn/nnv5OoZJEIB+VmuKn3DCUcCZSFlQ PSXSfBDiUGhwOw76WuSSsf1D4b/vLoJ10wIDAQAB -----END RSA PUBLIC KEY----- -----BEGIN RSA PRIVATE KEY----- MIIEqAIBAAKCAQEAhAKYdtoeoy8zcAcR874L8cnZxKzAGwd7v36APp7Pv6Q2jdsP BRrwWEBnez6d0UDKDwGbc6nxfEXAy5mbhgajzrw3MOEt8uA5txSKobBpKDeBLOsd JKFqMGmXCQvEG7YemcxDTRPxAleIAgYYRjTSd/QBwVW9OwNFhekro3RtlinV0a75 jfZgkne/YiktSvLG34lw2zqXBDTC5NHROUqGTlML4PlNZS5Ri2U4aCNx2rUPRcKI lE0PuKxI4T+HIaFpv8+rdV6eUgOrB2xeI1dSFFn/nnv5OoZJEIB+VmuKn3DCUcCZ SFlQPSXSfBDiUGhw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22m qQKBiD5GwESzsFPy3Ga0MvZpn3D6EJQLgsnrtUPZx+z2Ep2x0xc5orneB5fGyF1P WtP+fG5Q6Dpdz3LRfm+KwBCWFKQjg7uTxcjerhBWEYPmEMKYwTJF5PBG9/ddvHLQ EQeNC8fHGg4UXU8mhHnSBt3EA10qQJfRDs15M38eG2cYwB1PZpDHScDnDA0= -----END RSA PRIVATE KEY-----
The following key is a 2048-bit RSA public and private key pair, referred to in this document as test-key-rsa-pss:¶
-----BEGIN PUBLIC KEY----- MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAr4tmm3r20Wd/PbqvP1s2 +QEtvpuRaV8Yq40gjUR8y2Rjxa6dpG2GXHbPfvMs8ct+Lh1GH45x28Rw3Ry53mm+ oAXjyQ86OnDkZ5N8lYbggD4O3w6M6pAvLkhk95AndTrifbIFPNU8PPMO7OyrFAHq gDsznjPFmTOtCEcN2Z1FpWgchwuYLPL+Wokqltd11nqqzi+bJ9cvSKADYdUAAN5W Utzdpiy6LbTgSxP7ociU4Tn0g5I6aDZJ7A8Lzo0KSyZYoA485mqcO0GVAdVw9lq4 aOT9v6d+nb4bnNkQVklLQ3fVAvJm+xdDOp9LCNCN48V2pnDOkFV6+U9nV5oyc6XI 2wIDAQAB -----END PUBLIC KEY----- -----BEGIN PRIVATE KEY----- MIIEvgIBADALBgkqhkiG9w0BAQoEggSqMIIEpgIBAAKCAQEAr4tmm3r20Wd/Pbqv P1s2+QEtvpuRaV8Yq40gjUR8y2Rjxa6dpG2GXHbPfvMs8ct+Lh1GH45x28Rw3Ry5 3mm+oAXjyQ86OnDkZ5N8lYbggD4O3w6M6pAvLkhk95AndTrifbIFPNU8PPMO7Oyr FAHqgDsznjPFmTOtCEcN2Z1FpWgchwuYLPL+Wokqltd11nqqzi+bJ9cvSKADYdUA AN5WUtzdpiy6LbTgSxP7ociU4Tn0g5I6aDZJ7A8Lzo0KSyZYoA485mqcO0GVAdVw 9lq4aOT9v6d+nb4bnNkQ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xifV9P3wNBNrZGSIF3mrORBVNDAoGBAI0QKn2Iv7Sgo4T/XjND dl2kZTXqGAk8dOhpUiw/HdM3OGWbhHj2NdCzBliOmPyQtAr770GITWvbAI+IRYyF S7Fnk6ZVVVHsxjtaHy1uJGFlaZzKR4AGNaUTOJMs6NadzCmGPAxNQQOCqoUjn4XR rOjr9w349JooGXhOxbu8nOxX -----END PRIVATE KEY-----
The following key is an elliptical curve key over the curve P-256, referred to in this document as test-key-ecc-p256.¶
-----BEGIN EC PRIVATE KEY----- MHcCAQEEIFKbhfNZfpDsW43+0+JjUr9K+bTeuxopu653+hBaXGA7oAoGCCqGSM49 AwEHoUQDQgAEqIVYZVLCrPZHGHjP17CTW0/+D9Lfw0EkjqF7xB4FivAxzic30tMM 4GF+hR6Dxh71Z50VGGdldkkDXZCnTNnoXQ== -----END EC PRIVATE KEY-----
-----BEGIN PUBLIC KEY----- MFkwEwYHKoZIzj0CAQYIKoZIzj0DAQcDQgAEqIVYZVLCrPZHGHjP17CTW0/+D9Lf w0EkjqF7xB4FivAxzic30tMM4GF+hR6Dxh71Z50VGGdldkkDXZCnTNnoXQ== -----END PUBLIC KEY-----
This section provides non-normative examples that may be used as test cases to validate implementation correctness. These examples are based on the following HTTP messages:¶
For requests, this test-request message is used:¶
POST /foo?param=value&pet=dog HTTP/1.1 Host: example.com Date: Tue, 20 Apr 2021 02:07:55 GMT Content-Type: application/json Digest: SHA-256=X48E9qOokqqrvdts8nOJRJN3OWDUoyWxBf7kbu9DBPE= Content-Length: 18 {"hello": "world"}
For responses, this test-response message is used:¶
HTTP/1.1 200 OK Date: Tue, 20 Apr 2021 02:07:56 GMT Content-Type: application/json Digest: SHA-256=X48E9qOokqqrvdts8nOJRJN3OWDUoyWxBf7kbu9DBPE= Content-Length: 18 {"hello": "world"}
This example presents a minimal Signature-Input and Signature header for a signature using the rsa-pss-sha512 algorithm over test-request, covering none of the content of the HTTP message request but providing a timestamped signature proof of possession of the key.¶
The corresponding signature input is:¶
"@signature-params": ();created=1618884475\ ;keyid="test-key-rsa-pss";alg="rsa-pss-sha512"
This results in the following Signature-Input and Signature headers being added to the message:¶
Signature-Input: sig1=();created=1618884475\ ;keyid="test-key-rsa-pss";alg="rsa-pss-sha512" Signature: sig1=:VrfdC2KEFFLoGMYTbQz4PSlKat4hAxcr5XkVN7Mm/7OQQJG+uX\ gOez7kA6n/yTCaR1VL+FmJd2IVFCsUfcc/jO9siZK3siadoK1Dfgp2ieh9eO781ty\ SS70OwvAkdORuQLWDnaDMRDlQhg5sNP6JaQghFLqD4qgFrM9HMPxLrznhAQugJ0Fd\ RZLtSpnjECW6qsu2PVRoCYfnwe4gu8TfqH5GDx2SkpCF9BQ8CijuIWlOg7QP73tKt\ QNp65u14Si9VEVXHWGiLw4blyPLzWz/fqJbdLaq94Ep60Nq8WjYEAInYH6KyV7EAD\ 60LXdspwF50R3dkWXJP/x+gkAHSMsxbg==:
This example covers all the specified headers in test-request except for the body digest header using the rsa-pss-sha512 algorithm.¶
The corresponding signature input is:¶
"host": example.com "date": Tue, 20 Apr 2021 02:07:55 GMT "content-type": application/json "@signature-params": ("host" "date" "content-type")\ ;created=1618884475;keyid="test-key-rsa-pss"
This results in the following Signature-Input and Signature headers being added to the message:¶
Signature-Input: sig1=("host" "date" "content-type")\ ;created=1618884475;keyid="test-key-rsa-pss" Signature: sig1=:Zu48JBrHlXN+hVj3T5fPQUjMNEEhABM5vNmiWuUUl7BWNid5Rz\ OH1tEjVi+jObYkYT8p09lZ2hrNuU3xm+JUBT8WNIlopJtt0EzxFnjGlHvkhu3KbJf\ xNlvCJVlOEdR4AivDLMeK/ZgASpZ7py1UNHJqRyGCYkYpeedinXUertL/ySNp+VbK\ 2O/qCoui2jFgff2kXQd6rjL1Up83Fpr+/KoZ6HQkv3qwBdMBDyHQykfZHhLn4AO1I\ G+vKhOLJQDfaLsJ/fYfzsgc1s46j3GpPPD/W2nEEtdhNwu7oXq81qVRsENChIu1XI\ FKR9q7WpyHDKEWTtaNZDS8TFvIQRU22w==:
This example covers all headers in test-request plus the request target and message body digest using the rsa-pss-sha512 algorithm.¶
The corresponding signature input is:¶
"@request-target": post /foo?param=value&pet=dog "host": example.com "date": Tue, 20 Apr 2021 02:07:55 GMT "content-type": application/json "digest": SHA-256=X48E9qOokqqrvdts8nOJRJN3OWDUoyWxBf7kbu9DBPE= "content-length": 18 "@signature-params": ("@request-target" "host" "date" \ "content-type" "digest" "content-length");created=1618884475\ ;keyid="test-key-rsa-pss"
This results in the following Signature-Input and Signature headers being added to the message:¶
Signature-Input: sig1=("@request-target" "host" "date" \ "content-type" "digest" "content-length");created=1618884475\ ;keyid="test-key-rsa-pss" Signature: \ sig1=:iD5NhkJoGSuuTpWMzS0BI47DfbWwsGmHHLTwOxT0n+0cQFSC+1c26B7IOfI\ RTYofqD0sfYYrnSwCvWJfA1zthAEv9J1CxS/CZXe7CQvFpuKuFJxMpkAzVYdE/TA6\ fELxNZy9RJEWZUPBU4+aJ26d8PC0XhPObXe6JkP6/C7XvG2QinsDde7rduMdhFN/H\ j2MuX1Ipzvv4EgbHJdKwmWRNamfmKJZC4U5Tn0F58lzGF+WIpU73V67/6aSGvJGM5\ 7U9bRHrBB7ExuQhOX2J2dvJMYkE33pEJA70XBUp9ZvciTI+vjIUgUQ2oRww3huWML\ mMMqEc95CliwIoL5aBdCnlQ==:
This example covers portions of the test-response response message using the ecdsa-p256-sha256 algorithm and the key test-key-ecc-p256.¶
The corresponding signature input is:¶
"date": Tue, 20 Apr 2021 02:07:56 GMT "content-type": application/json "digest": SHA-256=X48E9qOokqqrvdts8nOJRJN3OWDUoyWxBf7kbu9DBPE= "content-length": 18 "@signature-params": ("date" "content-type" "digest" \ "content-length");created=1618884475;keyid="test-key-ecc-p256"
This results in the following Signature-Input and Signature headers being added to the message:¶
Signature-Input: sig1=("date" "content-type" "digest" \ "content-length");created=1618884475;keyid="test-key-ecc-p256" Signature: \ sig1=:3zmRDW6r50/RETqqhtx/N5sdd5eTh8xmHdsrYRK9wK4rCNEwLjCOBlcQxTL\ 2oJTCWGRkuqE2r9KyqZFY9jd+NQ==:
This example covers portions of the test-request using the hmac-sha256 algorithm and the secret test-shared-secret.¶
The corresponding signature input is:¶
"host": example.com "date": Tue, 20 Apr 2021 02:07:55 GMT "content-type": application/json "@signature-params": ("host" "date" "content-type")\ ;created=1618884475;keyid="test-shared-secret"
This results in the following Signature-Input and Signature headers being added to the message:¶
Signature-Input: sig1=("host" "date" "content-type")\ ;created=1618884475;keyid="test-shared-secret" Signature: sig1=:x54VEvVOb0TMw8fUbsWdUHqqqOre+K7sB/LqHQvnfaQ=:
This specification was initially based on the draft-cavage-http-signatures internet draft. The editors would like to thank the authors of that draft, Mark Cavage and Manu Sporny, for their work on that draft and their continuing contributions.¶
The editors would also like to thank the following individuals for feedback, insight, and implementation of this draft and its predecessors (in alphabetical order): Mark Adamcin, Mark Allen, Paul Annesley, Karl Böhlmark, Stéphane Bortzmeyer, Sarven Capadisli, Liam Dennehy, ductm54, Stephen Farrell, Phillip Hallam-Baker, Eric Holmes, Andrey Kislyuk, Adam Knight, Dave Lehn, Dave Longley, Ilari Liusvaara, James H. Manger, Kathleen Moriarty, Mark Nottingham, Yoav Nir, Adrian Palmer, Lucas Pardue, Roberto Polli, Julian Reschke, Michael Richardson, Wojciech Rygielski, Adam Scarr, Cory J. Slep, Dirk Stein, Henry Story, Lukasz Szewc, Chris Webber, and Jeffrey Yasskin.¶
RFC EDITOR: please remove this section before publication ¶