-
Notifications
You must be signed in to change notification settings - Fork 3
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
Ed25519ph as supported signature algorithm #2
Comments
Hi Herman, I must confess that I don't follow what Ed25519ph would bring over Ed25519 here, since the message to be signed/verified is guaranteed to be very small. It can fit in memory, and can be seamlessly sent to a HSM. A hash of that message wouldn't be significantly smaller. There's also an API issue. Implementations of signature schemes often require the message to be signed, not a hash of it, which is done internally. This is also the case for Ed25519ph, which in addition to that, is not widely implemented. Ed25519ph is also not supported by HSMs, and not part of the WASI crypto extension spec either (the latter can be addressed, but the HSM part would remain an issue). |
There's a major difference between what's being done here and Ed25519ph. What is being signed is not a hash of a message. It's a message made of the concatenation of multiple hashes, each representing one or more sections of the WebAssembly module. |
Yes, I agree with your points. Adding The reason I'm looking into supporting Cosign can already sign arbitrary blobs, and there's also some documentation for using it to sign Wasm here. But those are not directly compatible with the WebAssembly Signature proposal and operate on the full binary blob instead. So my idea is roughly to be able to do
That's why for |
Not entirely related, but is it possible the reference implementation is not fully in line with the example at https://github.com/WebAssembly/tool-conventions/blob/main/Signatures.md#signature-algorithms-and-key-serialization? I was looking at the description and noticed that the signature seems to include the type of key (
The signature length in a detached signature without key ID I generated using |
Good catch. Signatures should include the algorithm prefix (matching the one from the public key). That was a last minute addition to the spec, and |
Regarding prehashing, adding support for ECDSA to the spec (or replacing Ed25519 with it) may be better than Ed25519ph. It is more widely available, and has a higher probably of having APIs allowing to sign a hash. By the way, signing or verifying a hash with plain EdDSA is possible (the message just needs to be prefixed with Still, relying on the fact that signature systems prehash the data in a specific way doesn't sound ideal. Besides API issues, there are no guarantees that signature schemes will support it. If I recall correctly, post-quantum signature schemes, including Falcon and Dilithium are incompatible with that (there were discussions on the CFRG list about it, but I don't think they went anywhere). I'm not familiar enough enough with Sigstore, but if it requires signing a message but verifying a hash of that message, that looks like a design issue. It would be better for Sigstore to hash the input itself (regardless of what the signature system does internally) and feed that as the message to the signature function. |
Yes, after my previous messages I started thinking about going this route instead with
I haven't looked into all bits of Sigstore in detail, but if I understand correctly, at verification time you usually have access to the original binary data (you're verifying a binary or Docker image just before using it, for example; similar to what you'd do for Wasm modules). The part that doesn't support the |
The |
I have to look at So, Rekor gets you the hash and the signature. In Rekor supports Minisign, that also uses Ed25519. What's so different here? |
The big difference is making this compatible with Keyless mode uses a temporary key pair ( EDIT (after thinking about this some more): for verification, the cert + signature are sufficient (e.g. Note that the Rekor part isn't strictly required, and can be skipped using You're right that there are many parts in the Sigstore stack that already support The
Great; thank you! I'll update my Go version 😄 |
The additional byte now comes right after the key ID, instead of within the X number of bytes.
As opposed to
Both options work, and I don't see a strong reason to pick one over the other, as I think both will get the job done. It does need a slight update to the proposal text/schematic, though. I hacked together a flow, incl. Rekor using ECDSA P-256. I'll use the algorithm identifier to denote a |
Awwww crap. That being said, it shows that having the algorithm ID before the signature is more intuitive from an implementation perspective. And it actually makes more sense. The So, maybe we should update the spec. |
Yes, the type before the signature itself totally makes sense 🙂 |
Signed-off-by: Martijn Stevenson <[email protected]>
Hey @jedisct1,
I'm toying around using
wasmsign
and thought it could be nice ifEd25519ph
were supported (officially). I'm trying to use it with a system in which there are some cases for whichEd25519
doesn't work, because there's no access to the original signature content bytes in specific code paths, primarily related to signing/verification happening locally vs. remotely.Based on what's described at https://github.com/WebAssembly/tool-conventions/blob/main/Signatures.md#signature-algorithms-and-key-serialization, additional signature schemes can be supported, but then (at the least) would need some kind of different identifier. Do you think adding
Ed25519ph
is worth adding to the proposal/documentation?The current proposal and implementation seem to be doing something similar to prehashing already, although it uses SHA-256, and the "domain specific" context bytes here. Not saying it's exactly the same; just noting some rough similarities.
For the
Ed25519ph
case, I think it could become something likeEd25519ph(k, sha512(current-hashes-incl-wasmsign-context), context(some-wasmsign-context))
. Keeping thecurrent-hashes-incl-wasmsign-context
keeps most parts of the verification the same as forEd25519
with only a small cost in number of bytes. The newcontext(some-wasmsign-context)
could contain the same or other bytes (or just be empty, I guess?).The text was updated successfully, but these errors were encountered: