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

secretID / nonce in plaintext in derecmessage.proto #11

Closed
lbaird opened this issue Nov 14, 2023 · 15 comments
Closed

secretID / nonce in plaintext in derecmessage.proto #11

lbaird opened this issue Nov 14, 2023 · 15 comments

Comments

@lbaird
Copy link
Collaborator

lbaird commented Nov 14, 2023

The comments in derecmessage.proto currently say:

The OpenPGP format is used for the signed-then-encrypted message, which is then sent.

That should actually say:

The OpenPGP format is used for the signed-then-encrypted message. The sender then sends the concatenation of the nonce (for pairing mesage and response) or secretID (for any other message), which is an 8-byte, big-endian integer, followed by the signed-then-encrypted message.

With this addition, the receiver of a message will always know what key to use to decrypt it (if the receiver has more than one encryption key), and what key to use to verify the signature.

@jorabin
Copy link
Contributor

jorabin commented Nov 15, 2023

secret id is 1-16 bytes. It would be preferable to distinguish what the value of the preamble is e.g. 0 - you must guess based of trial and error decryption, 1 - it's an 8 byte nonce, 2 - it's a 1-16 byte secret id, other values for later allocation. Porbably useful for all of them to have a length byte too, so 0 0, 1 8, 2 1-16

@lbaird
Copy link
Collaborator Author

lbaird commented Nov 15, 2023 via email

@jorabin
Copy link
Contributor

jorabin commented Nov 17, 2023

There is an issue if sharers choose small secret ids. Let's say that a sharer says "I am only every going to have one secret and its id is 1". Another sharer may say the same thing. Then using the secret id as the plain text identifier for the communication leaves the helper with ambiguity as to which pairing is referred to.

Propose that instead of using the secret id as a pairing reference, the pairing process allows the helper and sharer to exchange references to be used for this purpose.

So the pair request would contain an int "My ref" which is what the helper should put into the plain text portion when sending to the sharer and the pair response would likewise contain a "My ref" field which is what the sharer should put in to the plain text portion, after the initial Pair Request, which contains the nonce from the communication info.

Noting that the secret id and the pairing reference will be in 1:1 correspondence from the sharer's point of view, the sharer might choose to use the secret if as its pairing reference, however the helper is free to choose any value it wishes, and might be expected to choose some randomly generated value.

@lbaird
Copy link
Collaborator Author

lbaird commented Nov 17, 2023 via email

@lbaird
Copy link
Collaborator Author

lbaird commented Nov 17, 2023 via email

@jorabin
Copy link
Contributor

jorabin commented Nov 17, 2023

Now moot, see following comment.

My understanding from our earlier conversations about this was that the secret id is allowed to be between 1 and 16 bytes because this accommodates both the use case of a sharer saying "I am only ever going to have one secret and its id is 1" and the use case where a sharer wishes to use a UUID as a secret id.

If the secret is randomly generated then that reduces the problem, however, in order to reduce still further the possibility of mis-operation as a result sharers mis-operating or behaving badly, there seems value in allowing helpers a choice as to the reference they would like to use for a pairing, rather than requiring them to use one that a sharer has chosen.

@jorabin
Copy link
Contributor

jorabin commented Nov 17, 2023

Previous comment now moot and we have resolved to add a "pairing reference" or "keyId" which is generated by both parties for use by the other party to identify the pairing. We can argue about whether it is called pairing id or key id.

So for avoidance of doubt, the plain text preamble consists of a TLV triple, where type can be:

0 - No information is present, the recipient is expected to try exhaustive search over keys it knows about
1 - The value that follows is the nonce given in the communication info - this is used on the PAIR REQUEST only.
2 - The value is a pairing reference, as received in a pairing request or response.

@lbaird
Copy link
Collaborator Author

lbaird commented Nov 17, 2023 via email

@jorabin
Copy link
Contributor

jorabin commented Nov 17, 2023

I was under the impression from earlier comments that you would like to preserve the option of having the receiver try their keys in turn, however that's not something we want/need.

I'm happy that this should be construed as a key id and not a pairing id since as noted pairings may share keys.

Happy with removal of nonce from contact, pair request and pair reply messages and substitution of key id in contact and pair request messages.

I am slightly nervous about throwing away the possibility of extensibility of what the payload for the plaintext part is. But let's go with it as discussed here.

@lbaird
Copy link
Collaborator Author

lbaird commented Nov 17, 2023 via email

@jorabin
Copy link
Contributor

jorabin commented Nov 17, 2023

Nonce also appears in the pair reply message. Curious as to what purpose it serves?

@lbaird
Copy link
Collaborator Author

lbaird commented Nov 17, 2023 via email

@lbaird
Copy link
Collaborator Author

lbaird commented Nov 17, 2023 via email

@jorabin
Copy link
Contributor

jorabin commented Nov 17, 2023 via email

@jorabin
Copy link
Contributor

jorabin commented Nov 22, 2023

PR #12 addresses this

@jorabin jorabin closed this as completed Nov 22, 2023
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

No branches or pull requests

2 participants