-
Notifications
You must be signed in to change notification settings - Fork 9
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Creating and Signing the Signature String #54
Comments
Yes, there are some quirks. Probably using google docs to discuss those editorial points could be of some benefit. I can share a copy if you agree. |
@ioggstream |
This is already implicit in the signature scheme. Without getting into the details, implementations will generally invoke a library to sign content, which includes the hash function since one rarely wants to sign a message directly (and cannot if the message is too long vs the key length). While the canonicalisation is novel (how to generate the string) the actual signature is not and we should refer to the existing literature. We already reference RFCs 6234, 8017 & 8032, and should encourage implementers to re-use these functions rather than juggling hashes. |
+1 ... I think the reason hashes started leaking into the canonicalization algorithm is because we deprecated The only other reason I can think of to consider "pre-hashing" the canonicalized string is to provide better support for hardware secured devices with limited bandwidth/memory. |
You have some good points and I can stand behind the recommendation from @dlongley send me trough E-mail.
Also, The Signature String is not a result of hashing the string containing the headers with their values. I'm still not sure what we should do about the text
The HTTP Message, or 'payload' how it is in the Google Docs, is not mentioned anywhere else in the specification. Is the Message/Body a proposal to add to the signature string in the specification? Or is it leftover from previous drafts? |
@RayTrommelenInfoSupport I think we could create a PR with your suggestion and change the
|
The HTTP Message is not equivalent to the payload, but rather the entire message transmitted as either a request or response. See RFC7230 2.1:
The payload is only the body, as per RFC7230 3.3:
In that respect, the message is used to find the content to be signed according to the specification of the headers value to determine the headers and pseudo-headers to include in the signature string (canonicalisation). If anything, the language should be:
|
This is impossible. RSA and EC keys do not contain a hash or hash specification, and while a certificate does have a hashed signature it is only what the issuing CA decided to use to sign the certificate - it is not relevant to any signature produced by the associated private key. For example, a certificate signed with Even the "fingerprint" of a certificate, often used as an identifier, is not stored in the certificate itself, but derived from the the entire certificate as represented in DER format, and can be generated by any hash algorithm, as illustrated:
Trying to deduce which algorithm to use is also not possible just by looking at the produced signature, e.g. SHA2-256 and SHA3-256 both produce 256-bit hashes. The hash algorithm is not a parameter to the signature algorithm itself, but rather produces the (short) data to be fed into that algorithm. EC and RSA signature schemes all operate independently and in the same way regardless of the specific hash fed into them by a particular hash algorithm. We cannot deduce the hash to be used from the key or certificate. Implementers MAY require a particular hash be used for a given key, but this is a detail and decision of the implementer, not something we can assume is readily derived in all instances. |
According to the Internet-Draft, the signature string is the headers and their values in the way it's defined in the Creating the Signature String paragraph. So, wouldn't we need to remove the 'algorithm' as well from this? |
Just as soon as you have a reliable way to determine the hash algorithm from the key metadata, which I present in #54 (comment) is not reliably possible. |
While keys are independent from the hashing method (if any, depending on the signature scheme), that does not mean that a particular instance of a key should not be bound to using a particular hash algorithm. It's also not impossible to do this in general, though I submit that you may not be able to ascertain this information when the key identifier can only be resolved to an X.509 certificate that lacks the requisite information. Our usage, for example, did not have this problem as we used Linked Data key descriptions not X.509 certificates. We'll need to decide how to support the existing X.509 certificate use case; either we tell users that they must track this additional constraint separately when using the new version of the spec or do what we're doing with defaults. Ideally, we would not bring back the potential attack vector that allows an adversary to control which hash is used to check the signature, even it's quite difficult to produce a real problem. |
iiuc, JWS links hash and algorithms https://tools.ietf.org/html/rfc7518#section-3.1 We could adopt that table or create our one. In both case it would be difficult to remove Another thread will be whether to add the |
We can clearly state the implications of being open on hash algorithm choice, and recommend implementations be strict about the algorithms they accept. Note that we aren't prescriptive of the We've already deprecated SHA1, but going further and listing algorithms in this specification is problematic - ten years from now hopefully this specification will still be valid, but the algorithms may well have moved on. The JWS spec linked above makes no mention of SHA3 for example, although this is gaining a lot of traction. We can certainly reference it (or another source), bit I don't think we should be reinventing the wheel, and then only as a suggestion. Implementations are always responsible for the eventual choices they make and should be free to do as they need. We need to describe how a signer specifies the hash, but an implementation that accepts SHA2-512 and MD5 as equally valid is beyond our control. While we don't have a solid way of describing which hashes an implementation would accept, we also can't expect every decision to be handled in this protocol. |
There are a few things with this list I'd like to make a pull request for. Before I'll make some changes, I was wondering what others thought about it.
First, to me it's not clear that the signature string should be hashed. I'd suggest adding an extra point, and stating the Signature String should be hashed.
Secondly, it states that the contents of the HTTP message should be used to create the Signature String. To me, this means that the body of the message should be added, but this not stated anywhere else in the specification. Thus, this confuses me and I wonder if this has become irrelevant?
Based on these points, I thought the next list could replace it.
The text was updated successfully, but these errors were encountered: