WIP: keyfork-shard: limit size of encrypted payload, can fit at max a 256 bit shard #26

Closed
ryan wants to merge 1 commits from ryan/optimize-hunk into main
Owner

This change is backwards-incompatible and will require a version bump, but knocks 9 words off of the remote hunk. That space can be reclaimed by moving the nonce from the combiner payload to the operator payload.

Side note: combiner payload does not have a hunk version. That should be remedied in the same change. It will take four bytes.

This change is backwards-incompatible and will require a version bump, but knocks 9 words off of the remote hunk. That space can be reclaimed by moving the nonce from the combiner payload to the operator payload. Side note: combiner payload does _not_ have a hunk version. That should be remedied in the same change. It will take four bytes.
ryan added 1 commit 2024-02-10 05:46:07 +00:00
ryan changed title from keyfork-shard: limit size of encrypted payload, can fit at max a 256 bit shard to WIP: keyfork-shard: limit size of encrypted payload, can fit at max a 256 bit shard 2024-02-10 05:46:33 +00:00
Author
Owner

Waiting on confirmation of moving nonce.

Waiting on confirmation of moving nonce.
Author
Owner

note: nonce is sent over an assumed authenticated channel, tampering with the nonce is not considered an option, and if someone can send an invalid nonce over the authenticated channel, they can also just initialize their own decrypt request. nonce tampering only becomes an issue with authenticated requests (see: #23, #24). once that's done, authenticated payloads will look like the following:

1-byte version number: 0x01
1-byte is-authenticated flag: 0x01
2-byte padding
32-byte ephemeral public key
8-byte timestamp: std::time::SystemTime::now().duration_since(UNIX_EPOCH)?.as_secs()
64-byte signature(ephemeral public key || timestamp)

Total payload is 81 words and should be encoded all at once.

Unauthenticated payloads will look like the following:

1-byte version number: 0x01
1-byte is-authenticated flag: 0x00
2-byte padding
32-byte ephemeral public key

Total payload is 27 words and should be encoded all at once.

Payload from the client will be:

32-byte public key
12-byte nonce
52-byte payload

Total payload is 72 words and should be encoded all at once.

The size decrease of the payload is now negated by the nonce, but in exchange authenticated payloads become possible and unauthenticated payloads are reduced to 27 words instead of 33 words.

note: nonce is sent over an assumed authenticated channel, tampering with the nonce is not considered an option, and if someone can send an invalid nonce over the authenticated channel, they can also just initialize their own decrypt request. nonce tampering only becomes an issue with authenticated requests (see: #23, #24). once that's done, authenticated payloads will look like the following: 1-byte version number: 0x01 1-byte is-authenticated flag: 0x01 2-byte padding 32-byte ephemeral public key 8-byte timestamp: `std::time::SystemTime::now().duration_since(UNIX_EPOCH)?.as_secs()` 64-byte signature(ephemeral public key || timestamp) Total payload is 81 words and should be encoded all at once. Unauthenticated payloads will look like the following: 1-byte version number: 0x01 1-byte is-authenticated flag: 0x00 2-byte padding 32-byte ephemeral public key Total payload is 27 words and should be encoded all at once. Payload from the client will be: 32-byte public key 12-byte nonce 52-byte payload Total payload is 72 words and should be encoded all at once. The size decrease of the payload is now negated by the nonce, but in exchange authenticated payloads become possible and unauthenticated payloads are reduced to 27 words instead of 33 words.
Author
Owner

Authentication of authenticated requests is not exclusive to enclaves and does not use enclave attestation. Enclave attestation can be added atop the existing framework to attest the public key used to verify the request. This assumes that, at some point, an authorized key is to be added to the shard payload file, likely as its own encrypted message.

Once this is implemented, keyfork-shard should also have some kind of repair-shardfile, which upgrades a shardfile from one version to the next. TODO: embed version in shardfile.

Authentication of authenticated requests is not exclusive to enclaves and does not use enclave attestation. Enclave attestation can be added atop the existing framework to attest the public key used to verify the request. This assumes that, at some point, an authorized key is to be added to the shard payload file, likely as its own encrypted message. Once this is implemented, keyfork-shard should also have some kind of `repair-shardfile`, which upgrades a shardfile from one version to the next. TODO: embed version in shardfile.
Author
Owner

no longer applicable, other PRs managed this better

no longer applicable, other PRs managed this better
ryan closed this pull request 2024-08-11 21:49:42 +00:00

Pull request closed

Sign in to join this conversation.
No reviewers
No Label
No Milestone
No project
No Assignees
1 Participants
Notifications
Due Date
The due date is invalid or out of range. Please use the format 'yyyy-mm-dd'.

No due date set.

Dependencies

No dependencies set.

Reference: public/keyfork#26
No description provided.