Skip to content
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

Standardized sender signature #30

Open
wants to merge 9 commits into
base: main
Choose a base branch
from

Conversation

cbeck88
Copy link
Contributor

@cbeck88 cbeck88 commented Mar 14, 2022

A proposal for a standardized signature for the sender of a TxOut, who may otherwise be anonymous.

Rendered Proposal

@@ -31,7 +31,7 @@ to secrets involved in the construction of the TxOut.

However, these numbers are useless for convincing a third-party who is not a party to the transaction,
because only the recipient is able to validate these numbers. There is currently no form of receipt that
can be validated just from the blockchain.
can be validated by anyone, just from the blockchain.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is this an observation about the current state of things, or an indication that this MCIP solves this problem? My understanding is that this MCIP doesn't propose to have on-chain receipts that can be validated by anyone, but that the off-chain store could be, is that correct?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

its not that the receipt lives on chain, but it's that:

  • I can prove to you that I sent a particular Tx
  • You don't have to even be the recipient of that Tx, and you can validated my proof just from the chain.

The receipts we have only work if you are the recipient of the Tx

Copy link
Contributor

@sugargoat sugargoat left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM!

@jcape
Copy link
Contributor

jcape commented Mar 15, 2022

I'd like to get #18 fixed up and merged first, this would simply this MCIP and resolve the major issue: you can't implement this without directly referencing an MCIP that was never accepted.

Alternatively, the contents of #18 can get merged into this one.

Janus attack mitigation.

We find a secondary use-case to motivate this: it becomes possible for the signer to create
a Schnorr signature over any payload, which a verifier can validate against the keys appearing
Copy link

@mfaulk mfaulk Mar 15, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

To make sure I'm following this: the public key that a sender would sign against is in the encrypted fog hint, so only the recipient's fog server can obtain this key and use it to verify messages signed with it? That doesn't sound right.

Copy link
Contributor Author

@cbeck88 cbeck88 Mar 15, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

so, the way that mc-crypto-box works is:

  • I get your public key (a Ristretto curve point)
  • I choose a random scalar (private fog key, r_fog in Koe's notation in Mechanics of Mobilecoin)
  • I do key exchange against your public key and r_fog, and I put r_fog * G as the first 32 bytes of the e_fog_hint.
  • I use the key resulting from key exchange to encrypt and mac my payload
  • I append 2 versioning bytes.

The recipient is getting those first 32 bytes, making a public key, and doing key exchange using their private key to recover the shared secret, decrypt and check the mac.

So the private key that a sender would sign against is r_fog (which now equals tx_private_key), and the signature can be validated against the public key r_fog * G, which is the first 32 bytes of fog hint.

Koe proposed that instead of having two independent random keys r and r_fog, we should just set r_fog = r, and this enables a Janus mitigation test, without really impacting fog since the r number is a perfectly fine secret key, just as good as r_fog anyways.

So this breaks some encapsulation that's separating the e_fog_hint field from the rest of the Tx math. But, it serves several useful purposes, and it's not that big a deal from the point of cryptobox / fog.

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks, that makes sense

# Summary
[summary]: #summary

Enact MCIP #18 (Janus Mitigation), which sets the ephemeral key in the encrypted fog hint
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We haven't merged MCIP 18, and it doesn't look like anyone has reviewed it yet. I think that needs to be reviewed and merged before we build on it. For example, I'm having a hard time finding the "fog hint ephemeral key" in the source, so it's hard for me to evaluate what's going on here.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

For sure, we should definitely review that MCIP and merge it separately if we want to accept this MCIP, IMO

@mfaulk
Copy link

mfaulk commented Mar 15, 2022

I'm wondering if the simplest thing to do here is to add a 'sender_signing_key' field to TxOut, which is a unique public key that is unrelated to tx_out.target_key and tx_out.public_key, and is unrelated to the fog hint. I know that would increase the size of the TxOut, but does that size increase really matter? On the flipside, it becomes extremely simple to say "this is the key that a sender should sign related data with", and anyone with access to the ledger can validate such signatures.

@cbeck88
Copy link
Contributor Author

cbeck88 commented Mar 15, 2022

I'm wondering if the simplest thing to do here is to add a 'sender_signing_key' field to TxOut, which is a unique public key that is unrelated to tx_out.target_key and tx_out.public_key, and is unrelated to the fog hint. I know that would increase the size of the TxOut, but does that size increase really matter?

It matters in that, it is a ledger format change, and an enclave change, and so would require a long turn-around time to ship.

It is certainly simpler conceptually to just add a new dedicated key field, but I'm not sure it's simpler taking into account the complexity of ledger format changes.

@NotGyro
Copy link

NotGyro commented Jul 28, 2022

This feels somewhat out of my depth, so this is probably a stupid question, but would the bytes signed include the memo field? I could see that being very useful.

@cbeck88
Copy link
Contributor Author

cbeck88 commented Jul 29, 2022

This feels somewhat out of my depth, so this is probably a stupid question, but would the bytes signed include the memo field? I could see that being very useful.

This signature is mainly about, taking bytes and binding them to "whoever sent that Txout" without revealing who it is.

The memo field is already set by that person and it's bound to the TxOut by the blockchain hash, so if I'm understanding right I think signing those bytes would be redundant.

But, part of the point of this is to allow signing "additional" memo-like bytes for use in other contexts that don't have to appear on the chain.

@jcape jcape removed request for a team, alanpaulin and davidyhall February 28, 2023 17:41
@joekottke joekottke removed request for brucek and jcape July 5, 2023 18:44
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants