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

Cross signing: implement signing our own devices #954

Open
bwindels opened this issue Dec 15, 2022 · 7 comments
Open

Cross signing: implement signing our own devices #954

bwindels opened this issue Dec 15, 2022 · 7 comments
Assignees

Comments

@bwindels
Copy link
Contributor

bwindels commented Dec 15, 2022

Depends on #953

Once we can trust our MSK with #953, we can now also trust the USK (User Signing Key) and SSK (Self Signing Key). The private keys for these are again stored in 4S, but verification should rather rely on the signatures from the MSK. We should only require to have the private keys when we actually want to sign something.

  • derive USK and SSK trust from parent key signature (MSK). This will not contain the hierarchical caching system for signature validation we eventually want, see Cross signing: implement the shields #957 for that.
  • sign own device with SSK
  • publish signature
  • sign other users with USK and publish signature
@bwindels
Copy link
Contributor Author

One note on the above, when we have the private MSK, we'll also have the private SSK and USK as they are all unlocked with the 4S key. So verification ... probably still good to check the signatures are ok, but we can rely on the private as well...

@bwindels
Copy link
Contributor Author

This is just adding support in code without exposing it in the UI, this happens in the next issue #955

@bwindels
Copy link
Contributor Author

bwindels commented Feb 14, 2023

Steps for own device signing

  • fetch SSK + signature
  • verify SSK signatures from MSK
  • get device key for our own device (already supported), the ed25519 one?
  • calculate signature with SSK
  • upload signature

@MidhunSureshR MidhunSureshR changed the title Cross signing: implement signing our own devices and other users Cross signing: implement signing our own devices Feb 16, 2023
@bwindels bwindels self-assigned this Feb 21, 2023
@bwindels
Copy link
Contributor Author

For signing other users and other devices apart from the current one:

  • rework way device keys are stored
    • so we can:
      • also store cross-signing keys in same store
      • store signatures
      • store in format as returned by server as that is what we have to calculate signatures on
    • for this, we'll:
      • rename deviceIdentities store to userKeys store
      • rename userIdentities store to userKeyTracking store
      • store device/msk keys in device format as returned by server
      • keep signatures in there, so we can later verify them if needed

@bwindels
Copy link
Contributor Author

Ah but we have an index on the curve25519 sender key for device keys which we don't have for cross-signing keys 🤔

@bwindels
Copy link
Contributor Author

For signing other users and other devices apart from the current one:

  • add crossSigningKeys store, key by userId|key, we also need to look up by userId|usage (which can contain multiple usages), have an multi index on here? How about IE support?
  • store signatures in deviceIdentites
  • remove crossSigningKeys from userIdentities
  • rename userIdentities to userKeyTracking?

@bwindels
Copy link
Contributor Author

From uhoreg:

The usage field gets included when calculating the signature, so an attacker can't get you to sign something and try to use the signature for something else, since the key indicates what the signatures can be used for. It is an array because we thought it might be useful to allow some key types in the future to have multiple usages, but you shouldn't have multiple usages with cross-signing.

So, in the end, we will:

  • create new crossSigningKeys store with the key being the userId and the usage of the key (we don't need to look up by public key, we'll usually verify from the MSK down to device keys, so we already have the parent key in memory)
  • store keys there not in response format but our own, smaller, format
  • store signatures in deviceIdentities

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant