mirror of
https://github.com/saymrwulf/swisspost-evoting-go-poc.git
synced 2026-09-06 20:40:58 +00:00
wire.go: the validated serialization boundary between parties. Crypto objects (group elements, public keys, Schnorr proofs, ciphertexts) travel as decimal DTOs; every decode routes through NewGqElement/NewZqElement so a peer cannot inject a value outside G_q or Z_q — closing the small-subgroup / non-residue hole (finding M4) at the trust boundary. setup.go: RunSetup drives distributed key generation over the bus. Each CC generates its ElGamal keypair + return-code secret PRIVATELY and returns only its public key and Schnorr proofs; the setup component verifies every proof on receipt before combining keys. The electoral board derives its own key and returns only the public key. Combined election PK and setup artifacts are published to the public transcript. Test confirms the combined election key equals the product of the individually generated CC and EB keys, and that private key material stays with each party (never appears in the transcript). Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
38 lines
1.2 KiB
Go
38 lines
1.2 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)
|
|
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) {
|
|
return nil, fmt.Errorf("%s: unhandled message type %q", p.id.Name, env.Type)
|
|
}
|