mirror of
https://github.com/saymrwulf/swisspost-evoting-go-poc.git
synced 2026-09-04 20:23:55 +00:00
Setup now generates each voter's return-code card by collecting shares from all four CCs over the bus (the GenEncLongCodeShares exchange) and distributes cards and the mapping table over CONFIDENTIAL channels. - codes.go: deriveReturnCodeKey is the SINGLE key-derivation function used by a CC both when contributing to card assembly and (later) at vote-time extraction — structurally preventing the setup/extraction derivation mismatch (F1). Each CC computes its choice/confirm shares from its private return-code secret; only the shares (validated as G_q members on decode) cross the bus. - RunCards assembles cards, registers mapping-table entries, and delivers cards to voters + the mapping table to the server via sendConfidential (X25519 ECDH session key + AES-256-GCM, then Ed25519-signed) — exercising the secure channel in the ceremony, not just in tests. - returncodes: MappingTable Export/ImportMappingTable for transport. Test confirms every voter receives its card confidentially with the right code count and the server receives the full mapping table + public election keys. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
45 lines
1.3 KiB
Go
45 lines
1.3 KiB
Go
package party
|
|
|
|
import (
|
|
"fmt"
|
|
|
|
"github.com/user/evote/pkg/transport"
|
|
)
|
|
|
|
// Phase message handlers. These are filled in incrementally (setup, then
|
|
// voting, then tally). Until a phase is implemented its handler rejects unknown
|
|
// message types cleanly rather than panicking — the transport boundary must
|
|
// never crash on an unexpected message.
|
|
|
|
func (p *SetupComponent) handleSetupMsg(env *transport.Envelope) (*transport.Envelope, error) {
|
|
return nil, fmt.Errorf("%s: unhandled message type %q", p.id.Name, env.Type)
|
|
}
|
|
|
|
func (p *ControlComponent) handleCCMsg(env *transport.Envelope) (*transport.Envelope, error) {
|
|
switch env.Type {
|
|
case MsgGenCCKeys:
|
|
return p.handleGenCCKeys(env)
|
|
case MsgLongCodeShareReq:
|
|
return p.handleLongCodeShare(env)
|
|
default:
|
|
return nil, fmt.Errorf("%s: unhandled message type %q", p.id.Name, env.Type)
|
|
}
|
|
}
|
|
|
|
func (p *ElectoralBoard) handleEBMsg(env *transport.Envelope) (*transport.Envelope, error) {
|
|
switch env.Type {
|
|
case MsgGenEBKey:
|
|
return p.handleGenEBKey(env)
|
|
default:
|
|
return nil, fmt.Errorf("%s: unhandled message type %q", p.id.Name, env.Type)
|
|
}
|
|
}
|
|
|
|
func (p *VotingServer) handleServerMsg(env *transport.Envelope) (*transport.Envelope, error) {
|
|
switch env.Type {
|
|
case MsgMappingTable:
|
|
return p.handleMappingTable(env)
|
|
default:
|
|
return nil, fmt.Errorf("%s: unhandled message type %q", p.id.Name, env.Type)
|
|
}
|
|
}
|